fix: pass team header when fetching default templates#340
fix: pass team header when fetching default templates#340devin-ai-integration[bot] wants to merge 2 commits into
Conversation
The /templates/defaults endpoint now requires team auth to filter templates for BYOC customers. Update the dashboard to send the X-Supabase-Team header when calling this endpoint. Changes: - Change createDefaultTemplatesRepository to use TeamRequestScope - Pass scope.teamId to auth headers in the API call - Use protectedTeamProcedure + withTeamAuthedRequestRepository in tRPC router - Update terminal page to pass teamId Co-Authored-By: ben@e2b.dev <ben@e2b.dev>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9cfb34c15c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const templatesRepositoryProcedure = protectedTeamProcedure.use( | ||
| withTeamAuthedRequestRepository( | ||
| createDefaultTemplatesRepository, |
There was a problem hiding this comment.
Preserve getDefaultTemplatesCached call compatibility
Changing templatesRepositoryProcedure to protectedTeamProcedure makes getDefaultTemplatesCached require teamSlug input, but existing callers still invoke this query without input (e.g. trpc.templates.getDefaultTemplatesCached.queryOptions(undefined, ...) in src/features/dashboard/templates/list/table.tsx). At runtime this causes input validation to fail for team template pages, so default template loading now errors instead of returning data.
Useful? React with 👍 / 👎.
The tRPC procedure now requires teamSlug input since it uses protectedTeamProcedure. Update the frontend caller to pass it. Co-Authored-By: ben@e2b.dev <ben@e2b.dev>
Summary
The
/templates/defaultsAPI endpoint now requires team auth (added in e2b-dev/infra#2805) to filter templates for BYOC customers. This PR updates the dashboard to send theX-Supabase-Teamheader when calling this endpoint.Changes:
repository.server.ts: ChangedcreateDefaultTemplatesRepositoryto acceptTeamRequestScopeand passscope.teamIdto auth headerstemplates.ts(tRPC router): Switched fromprotectedProcedure+withAuthedRequestRepositorytoprotectedTeamProcedure+withTeamAuthedRequestRepositoryterminal/page.tsx: PassteamIdtocreateDefaultTemplatesRepositorytable.tsx: PassteamSlugtogetDefaultTemplatesCachedquery (required byprotectedTeamProcedure)Review & Testing Checklist for Human
Notes
Companion PR: e2b-dev/infra#2805 (API-side change that returns empty templates when clusterID is defined).
Link to Devin session: https://app.devin.ai/sessions/3bab014a95b04fe49f44868d221e484d