Repository navigation
Conversation
…wSession
The cross-domain after-hook runs on every OAuth/magic-link callback and
mints a one-time token from ctx.context.newSession for the cross-domain
cookie handoff. On callbacks where the user is already authenticated —
e.g. linkSocial — no new session is created, so newSession is undefined
and the hook logs error("No session found") before returning.
That branch isn't an error: the provider's `location` redirect already
set on the response passes through the early return unchanged, so the
browser still returns to the app. Drop the misleading error log and
document why the branch is expected. No behavioral change.
|
@mishafyi is attempting to deploy a commit to the Convex Team on Vercel. A member of the Team first needs to authorize it. |
|
@erquhart — carrying your review over from #389 (that one is stuck closed after I botched a force-push; details there). Verified against current Re-scoped to just what's actually wrong: the |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: get-convex/coderabbit/.coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe cross-domain one-time-token callback now treats a missing 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Callbacks such as linkSocial and error redirects never create a session, so there is no one-time token to mint. Skip silently instead of logging "No session found" at error level. Audit of upstream convex#417. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Problem
The cross-domain after-hook fires on every OAuth / magic-link callback and mints a one-time token from
ctx.context.newSessionfor the cross-domain cookie handoff. When the user is already authenticated — e.g.linkSocial— no new session is created, sonewSessionisundefinedand the hook hits:…logging an error on a completely normal path.
Change
Drop the
logger.erroron that branch (and document why it's expected). As @erquhart noted on #389, the earlyreturndoesn't swallow anything: the provider'slocationredirect already set on the response passes through unchanged, so the browser still returns to the app — only the OTT handoff is (correctly) skipped when there's no new session. No behavioral change.Note
This started as a redirect fix we carried as a prod patch on the 0.10.x line. We've since removed the crossDomain plugin from our own setup, so I can't re-verify the original dead-end against current
better-auth— going with @erquhart's read that the redirect is preserved on the no-session path, and narrowing this to just the misleading log. Existingsrc/plugins/cross-domain/index.test.tsstill passes (6/6).