Skip to content

fix(www): reject Next.js 15 router state headers in proxy - #52071

Merged
ivasilov merged 2 commits into
masterfrom
ivasilov/fix-www-nextjs-16-sentry-issue
Oct 21, 2026
Merged

ivasilov merged 2 commits into
masterfrom
ivasilov/fix-www-nextjs-16-sentry-issue

Conversation

@ivasilov

@ivasilov ivasilov commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Problem

After upgrading www to Next.js 16, Sentry reports The router state header was sent but could not be parsed (WWW-63) on RSC requests such as /blog?_rsc=…. Next 15 clients (the docs zone, which is still on Next 15 and served under /docs, plus tabs opened before the deploy) send a Next-Router-State-Tree header whose fifth element is a boolean, while Next 16 requires a number, so the renderer throws and returns a 500.

Solution

proxy.ts now detects the Next 15-shaped router state header and returns a cheap 400 (no-store) before it reaches the renderer, for paths www serves itself. Paths rewritten to other zones (/docs, /dashboard, /kb, …) are exempt, because the docs zone is Next 15 and its own client navigations must pass through untouched. The Next 15 router falls back to a full page load on any non-RSC response, which is the same outcome users get today after the 500, minus the error noise and wasted renders. Unit tests cover the v15 shape, the v16 shape, a missing header and a malformed header. The proper long-term fix is upgrading apps/docs to Next 16, after which this guard can be removed.

Review instructions

  1. Run pnpm --filter=www test proxy.test.ts and confirm the new Next.js 15 router state tree tests pass.
  2. After deploy, confirm WWW-63 stops receiving new events.

Checklist

Check all before review:

  • I have read CONTRIBUTING.md
  • If I wrote a new docs topic or edited an existing topic, I used the /write-the-docs or /edit-the-docs skill, which applies the docs style guide

🤖 Generated with Claude Code

Next 15 clients (the docs zone, stale tabs) send a router state tree whose
fifth element is a boolean; Next 16 requires a number and throws a 500.
Return a 400 from the proxy so the client falls back to a full page load.

Fixes WWW-63

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@ivasilov
ivasilov requested a review from a team as a code owner October 21, 2026 11:15
@vercel

vercel Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
zone-www-dot-com Ready Ready Preview, v0 Oct 21, 2026 11:23am UTC
7 Skipped Deployments
Project Deployment Actions Updated
studio Ignored Ignored Oct 21, 2026 11:23am UTC
design-system Skipped Skipped Oct 21, 2026 11:23am UTC
docs Skipped Skipped Oct 21, 2026 11:23am UTC
kb Skipped Skipped Oct 21, 2026 11:23am UTC
studio-self-hosted Skipped Skipped Oct 21, 2026 11:23am UTC
studio-staging Skipped Skipped Oct 21, 2026 11:23am UTC
ui-library Skipped Skipped Oct 21, 2026 11:23am UTC

Request Review

@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: supabase/supabase/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7c8494f8-215d-4cf5-90b8-4936471c3e4e
📥 Commits

Reviewing files that changed from the base of the PR and between b8426f1 and 0129a90.

📒 Files selected for processing: 2
  • apps/www/proxy.test.ts
  • apps/www/proxy.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

📝 Walkthrough

The proxy detects legacy Next.js 15 router-state headers on non-zone paths and returns an empty 400 response with Cache-Control: no-store. Tests cover legacy, current, absent, and malformed router-state headers.

Changes: Router State Compatibility

Layer / File(s) Summary
Detect and reject legacy router state
apps/www/proxy.ts, apps/www/proxy.test.ts
The proxy detects a parseable router-state tree with a boolean fifth element on non-zone paths. It returns a no-store 400 response. Tests cover legacy-state rejection and pass-through for other zones, current state, absent headers, and malformed state.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: pamelachia

Merge Risk: ⚪ Minimal · up to 0129a

The identified compatibility path is covered, and no actionable merge-blocking risk remains after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: rejecting Next.js 15 router state headers in the www proxy.
Description check Passed The description includes complete Problem, Solution, Review instructions, and Checklist sections. It explains the affected Next.js versions, zone exclusions, tests, deployment validation, and long-ter…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description includes complete Problem, Solution, Review instructions, and Checklist sections. It explains the affected Next.js versions, zone exclusions, tests, deployment validation, and long-term fix.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ivasilov
ivasilov merged commit 3383f7e into master Oct 21, 2026
39 of 40 checks passed
@ivasilov
ivasilov deleted the ivasilov/fix-www-nextjs-16-sentry-issue branch October 21, 2026 11:30
ivasilov added a commit that referenced this pull request Oct 29, 2026
## Problem

#52071 added a guard in the www proxy that rejects Next.js 15 router
state headers, because the docs zone still ran Next.js 15. The docs
upgrade to Next.js 16 (#52045) has merged, so the guard is no longer
needed. Resolves
[FE-4685](https://linear.app/supabase/issue/FE-4685/revert-nextjs-15-router-header-guard-after-pr-52045-merges).

## Solution

Reverts #52071: removes the legacy router state tree check and the
`OTHER_ZONE_PREFIXES` list from `apps/www/proxy.ts`, along with its
tests in `apps/www/proxy.test.ts`.

## Review instructions

1. Confirm the diff matches the inverse of #52071.
2. Run `pnpm --filter=www exec vitest run proxy.test.ts` and see it
pass.

## Checklist

Check all before review:

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Sonnet 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants