Skip to content

fix: pass team header when fetching default templates#340

Open
devin-ai-integration[bot] wants to merge 2 commits into
mainfrom
devin/1779485049-pass-team-header-default-templates
Open

fix: pass team header when fetching default templates#340
devin-ai-integration[bot] wants to merge 2 commits into
mainfrom
devin/1779485049-pass-team-header-default-templates

Conversation

@devin-ai-integration
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot commented May 22, 2026

Summary

The /templates/defaults API endpoint now requires team auth (added in e2b-dev/infra#2805) to filter templates for BYOC customers. This PR updates the dashboard to send the X-Supabase-Team header when calling this endpoint.

Changes:

  • repository.server.ts: Changed createDefaultTemplatesRepository to accept TeamRequestScope and pass scope.teamId to auth headers
  • templates.ts (tRPC router): Switched from protectedProcedure + withAuthedRequestRepository to protectedTeamProcedure + withTeamAuthedRequestRepository
  • terminal/page.tsx: Pass teamId to createDefaultTemplatesRepository
  • table.tsx: Pass teamSlug to getDefaultTemplatesCached query (required by protectedTeamProcedure)

Review & Testing Checklist for Human

  • Verify default templates still load for non-BYOC teams (nil clusterID)
  • Verify default templates are empty/hidden for BYOC teams (non-nil clusterID)
  • Confirm the terminal page still resolves templates correctly

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

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-integration
Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@cla-bot cla-bot Bot added the cla-signed label May 22, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented May 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
web Ready Ready Preview, Comment May 22, 2026 9:57pm
web-juliett Ready Ready Preview, Comment May 22, 2026 9:57pm

Request Review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +12 to 14
const templatesRepositoryProcedure = protectedTeamProcedure.use(
withTeamAuthedRequestRepository(
createDefaultTemplatesRepository,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants