Skip to content

chore(deps): bump @supabase/ssr to ^0.10.2 + supabase-js to ^2.104.0 - #841

Merged
tran-christian merged 1 commit into
mainfrom
claude/debug-pending-cookies-FNAlV
Apr 22, 2026
Merged

chore(deps): bump @supabase/ssr to ^0.10.2 + supabase-js to ^2.104.0#841
tran-christian merged 1 commit into
mainfrom
claude/debug-pending-cookies-FNAlV

Conversation

@tran-christian

@tran-christian tran-christian commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #840. The diagnostic patch we merged yesterday surfaced the exact failure branch: /?error=auth_callback_error&reason=no_pending_cookies. That means exchangeCodeForSession returned successfully with data.session populated, but @supabase/ssr never called our cookies.setAll adapter — so the stamped session cookies we engineered in #830 / #833 / #835 / #840 never had anything to stamp.

Root cause is upstream in @supabase/ssr@0.8.0: an SSR race condition where the underlying GoTrue client auto-initializes asynchronously and races with the cookie-writing path. Fixed upstream in 0.8.1 via skipAutoInitialize: true. We've been pinned at 0.8.0 and missed it.

What changed

  • @supabase/ssr: ^0.8.0^0.10.2 — picks up 0.8.1's skipAutoInitialize fix plus 0.10.0's setAll cache headers (prevents CDN caching of auth responses on Vercel).
  • @supabase/supabase-js: ^2.91.0^2.104.0 — required by ssr@0.10.2's new peer range ^2.102.1.
  • pnpm-lock.yaml regenerated.

No source changes. No app code touches any removed or renamed API.

Non-breaking confirmation

Verified against both changelogs:

  • No breaking changes in @supabase/ssr 0.8.0 → 0.10.2.
  • No breaking changes in @supabase/supabase-js 2.91 → 2.104 for createClient, createServerClient, createBrowserClient, signInWithOAuth, signInWithOtp, exchangeCodeForSession, getSession, getUser, getClaims, or onAuthStateChange.
  • Our onAuthStateChange callback in src/context/AuthContext.tsx is not async, so the 2.74.0 async-callback deprecation doesn't affect us.

Test plan

  • CI green (ESLint, Unit Tests, Chromatic UI Tests, Vercel Preview, CodeQL)
  • Sign in on the preview deployment with Google → lands on / with session, welcome toast, no ?error=
  • DevTools → Application → Cookies: sb-<ref>-auth-token (and chunks if present) visible with Domain=omshub.org (from fix(auth): scope session cookies to registrable domain + diagnostic reasons #840)
  • auth_debug diagnostic cookie shows pendingCookieCount > 0 (confirms the fix — this was 0 before)
  • Magic-link sign-in still works on preview (different code path — browser client's exchange, no server callback involved, but shares the SSR package)
  • Sign in, refresh page a few times, session persists (proxy middleware refresh path)
  • Existing proxy unit test (src/lib/supabase/__tests__/proxy.test.ts) still passes

Rollback

Revert this commit — package-only change, no app or schema changes. Prior behavior restored immediately.

Related

@supabase/ssr 0.8.0 has an SSR race condition where the GoTrue client
auto-initializes asynchronously and can hijack the cookie-writing path
after exchangeCodeForSession. The symptom in our setup: /token returns
200, data.session is populated, but the SSR client never invokes the
cookies.setAll callback — so session cookies never reach the response.
Our diagnostic patch (#840) surfaced this exact branch as
?reason=no_pending_cookies.

Fixed upstream in 0.8.1 via skipAutoInitialize: true (PR #131).
Bumping to latest 0.10.2 picks up that fix plus 0.10.0's setAll cache
headers, which prevent proxies/CDNs from caching auth responses.

@supabase/supabase-js bumped to ^2.104.0 to satisfy the new peer
requirement (ssr 0.10.2 needs ^2.102.1). No breaking changes in either
package in the traversed range — createServerClient, createBrowserClient,
exchangeCodeForSession, getSession, getUser, onAuthStateChange all
retain their signatures.

No source changes — package.json + pnpm-lock.yaml only.
@vercel

vercel Bot commented Apr 22, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
website Ready Ready Preview, Comment Apr 22, 2026 3:23am

@tran-christian
tran-christian marked this pull request as draft April 22, 2026 03:23
@supabase

supabase Bot commented Apr 22, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project ilwqylsdqacxmfkisclx because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@tran-christian
tran-christian marked this pull request as ready for review April 22, 2026 03:26
@tran-christian
tran-christian merged commit 6c8f476 into main Apr 22, 2026
17 checks passed
@tran-christian
tran-christian deleted the claude/debug-pending-cookies-FNAlV branch April 22, 2026 03:26
tran-christian added a commit that referenced this pull request Apr 22, 2026
…ug cookie (#842)

With the root cause fixed in #841, the browser-side auth_debug cookie
from #840 has served its purpose — it was one-off scaffolding to prove
the pipeline carries cookies end-to-end. Replacing it with server-side
error logs in Vercel's runtime log viewer: zero client footprint, no
leaked deployment details to analytics/replay scripts, full context
when things actually go wrong.

next.config.js: removeConsole in prod now uses { exclude: ['error'] }
so console.error survives compilation. console.log/warn/info/debug are
still stripped. DEBUG_AUTH=1 continues to disable stripping entirely
for local `pnpm build && pnpm start` repro.

app/auth/callback/route.ts:
- Shared `diag` object captures the same fields the auth_debug cookie
  carried (forwardedHost, pendingCookieCount, pendingCookieNames,
  requestCookieNames, publishableKeyPrefix, origin, hasSession,
  hasUser) plus SDK-side signals.
- Every abnormal branch logs `[auth/callback] reason=<branch>` with
  `diag` to console.error. exchange_failed also includes the SDK
  message + status. no_code is not logged (crawler noise).
- auth_debug cookie + debugPayload construction removed.
- DEBUG_AUTH-gated console.log block removed — its content is a subset
  of `diag` and only fires now when something is actually wrong.
- Unused `oauth_error` option removed from failureRedirect's union.
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.

1 participant