Conversation
Adds temporary diagnostic logging at three points to pinpoint why the session set by /auth/callback is not visible to middleware on the next request to /dashboard: - callback setAll: logs cookie names + lengths the SDK is writing - callback return: logs cookies actually attached to the redirect response - middleware: logs incoming sb-* cookies, getUser user id, and error - set-session: logs setSession result + response cookies (hash-bridge path) Each addition is marked `// TEMP DIAG` and will be reverted once the bug is identified. Also surfaces the getUser error in middleware (previously dropped). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe PR adds temporary diagnostic logging to three authentication-related files in the Next.js application's auth flow. Logging statements capture setSession results, cookies being set and received, request paths, and user authentication state without modifying any functional logic. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
Summary
// TEMP DIAGlog statements at the auth-cookie boundary to pinpoint why the session set by/auth/callbackis not visible to middleware on the next request to/dashboard(users were getting bounced back to/login?redirectTo=%2Fdashboard).getUsererrorin middleware (previously dropped, masking real failures)./auth/callback/auth/callbackpath because Render'sNEXT_PUBLIC_APP_URLenv var is currently set tohttps://www.diamondos.app/auth/callbackinstead of the bare origin. That is a config fix, not a code fix — the env var must be changed on Render and Supabase Site URL / redirect-URL allowlist must be aligned (see plan file). Once that's done, redeploying this branch keeps the diagnostic logs in place as a tripwire in case anything else is still off, and a follow-up PR will revert them.Test plan
NEXT_PUBLIC_APP_URL=https://www.diamondos.app(origin only, no path)https://www.diamondos.appand ensure redirect-URL allowlist containshttps://www.diamondos.app/auth/callbackandhttps://www.diamondos.app/auth/callback/hashhttps://www.diamondos.app/loginhttps://www.diamondos.app/auth/callback?token_hash=…(single/auth/callback, no doubling)/dashboard, no/login?redirectTo=…bounce[auth/callback] setAll,[auth/callback] returning redirect cookies: [...sb-* cookie names...], and[middleware] /dashboard sbCookies: [...] user: <uuid> error: null— confirming end-to-end cookie flowFollow-up
// TEMP DIAGlog additions inapps/web/src/app/auth/callback/route.ts,apps/web/src/middleware.ts, andapps/web/src/app/api/auth/set-session/route.ts. (Keep theerrordestructure in middleware permanently — small win.)🤖 Generated with Claude Code
Summary by CodeRabbit