-
Notifications
You must be signed in to change notification settings - Fork 401
fix(backend): Complete satellite domain sync #7018
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: 080a183 The changes in this PR will be included in the next version bump. This PR includes changesets to release 11 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
💡 Enable Vercel Agent with $100 free credit for automated AI reviews |
WalkthroughReordered the DevBrowserSync handshake check in the token request authentication flow so multi-domain (MD) development sync handling runs first; added comments clarifying MD sync precedence to avoid root-domain handshakes during satellite handling. DevBrowserSync handling is re-applied after MD checks and returns via Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Client
participant AuthFn as authenticateRequest
participant MDCheck as MultiDomainSyncCheck
participant DevBrowser as DevBrowserSyncCheck
participant Handshake as handleMaybeHandshakeStatus
participant Response
Client->>AuthFn: request with possible __clerk_db_jwt / dev sync params
AuthFn->>MDCheck: evaluate multi-domain (primary/satellite) sync
alt Primary sync present
MDCheck-->>Handshake: PrimaryRespondsToSyncing
Handshake-->>Response: redirect to primary with __clerk_synced=true
else No primary sync
MDCheck->>DevBrowser: evaluate dev-browser-sync
alt DevBrowser handshake needed
DevBrowser-->>Handshake: DevBrowser handshake
Handshake-->>Response: handshake response
else
DevBrowser-->>AuthFn: continue normal dev-cookie / auth flow
AuthFn-->>Response: normal authentication result
end
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
Comment |
@clerk/agent-toolkit
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/elements
@clerk/clerk-expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/clerk-react
@clerk/react-router
@clerk/remix
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/themes
@clerk/types
@clerk/upgrade
@clerk/vue
commit: |
…irect loop This test reproduces the bug where the root domain would incorrectly trigger dev-browser-sync instead of handling multi-domain satellite sync requests, causing an infinite redirect loop. The test fails on main (broken behavior) and passes on this branch (fixed behavior), demonstrating the fix works correctly.
Description
When a satellite app initiated a multi-domain sync by redirecting to the root domain with
__clerk_redirect_url, the root domain was incorrectly triggering its own dev-browser-sync handshake before completing the satellite's sync request. This caused an infinite redirect loop between domains.Reordered the authentication checks so that when the root domain detects it's handling a multi-domain sync request (via
__clerk_redirect_url), it immediately redirects back to the satellite with__clerk_synced=trueand the dev browser token—without triggering its own handshakes first.Fixes: USER-3522
Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change
Summary by CodeRabbit
Refactor
Tests
Documentation