feat: trust Clerk Development instance tokens alongside production - #57
Merged
Merged
Conversation
Preview deployments now use Clerk Development instance keys (separate Frontend API domain from production), but Preview and Production currently share one Convex backend - there's no isolated per-PR backend, since the automated Vercel->Convex deploy pipeline turned out to be unreliable in Vercel's build container (see CONTRIBUTING.md). That one shared backend can only trust whatever issuer domains are listed in auth.config.ts's providers array. Until now that was just production's, so Development-instance tokens (used on every Preview build) were rejected with "no auth provider found matching the given token" even after a fully successful Clerk sign-in. Convex's auth.config.ts natively supports multiple trusted providers, so this adds the Development instance as a second entry rather than forcing Preview back onto production Clerk keys (which would reopen the untested question of whether Clerk's production instance accepts arbitrary preview URLs as valid origins).
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Preview deployments use Clerk Development instance keys, but Preview and Production currently share one Convex backend (no isolated per-PR backend - the automated Vercel→Convex deploy pipeline turned out to be unreliable inside Vercel's build container). That one backend only trusted production's Clerk issuer, so every Preview sign-in succeeded on Clerk's side but then failed the Convex handoff with "no auth provider found matching the given token."
Fix
`auth.config.ts`'s `providers` array natively supports multiple trusted issuers. Added the Development instance (`https://allowing-bulldog-0.clerk.accounts.dev\`) as a second entry alongside production, rather than forcing Preview back onto production Clerk keys (which would reopen the untested question of whether Clerk's production instance accepts arbitrary Vercel preview URLs as valid origins).
Deploy note
Per the current workflow (see companion CONTRIBUTING.md update), this needs a manual `npx convex deploy` after merging - Vercel's build no longer touches the Convex backend.