Skip to content

fix(proxy): bypass next-intl for RSC and server-action requests - #475

Merged
gkhngyk merged 1 commit into
mainfrom
fix/proxy-rsc-bypass
Jul 18, 2026
Merged

gkhngyk merged 1 commit into
mainfrom
fix/proxy-rsc-bypass

Conversation

@gkhngyk

@gkhngyk gkhngyk commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Soft navigations to the Prompts page (e.g. sidebar Visibility → Prompts) still froze after #474. Verified chain:

  1. A client-side navigation's RSC request carries the router state tree through the middleware.
  2. It intermittently dies server-side with Error: The router state header was sent but could not be parsed — captured in Vercel function logs; a known framework-level issue for apps with a broad proxy matcher on Vercel (App Router _rsc navigations intermittently fail with "The router state header was sent but could not be parsed" when Proxy matcher is broad on Vercel vercel/next.js#91723). fix(prompts): shallow-update tab/sort URL params instead of router.replace #474 removed the page's own mount-time trigger, but any navigation INTO the page is still an RSC request and can hit the same bug.
  3. The failed transition never completes, and Next holds all queued server actions behind it — so the page's data fetch never dispatches and the table spins forever.

Per the upstream issue, the failures disappear when the middleware stops processing these requests. With a single 'en' locale, the only thing next-intl's middleware does for them is the /en rewrite — so for any request carrying an RSC or Next-Action header, do that rewrite manually and skip the intl machinery entirely. Auth checks (Supabase session, protected-route redirect) still run first, and session cookies are still forwarded on the response. Document requests (no RSC header) keep flowing through next-intl unchanged.

Related issue

Second half of the urgent "prompts page never loads" fix (#474 was the first). Upstream: vercel/next.js#91723.

Type of change

  • feat — New feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

How to test

  1. From /dashboard/visibility (Insights), click Prompts in the sidebar repeatedly — the table must load every time; no request in the Network tab may return 500/503.
  2. Hard-reload /dashboard/prompts?tab=all — loads normally.
  3. Navigate across all sidebar pages — locale routing (/en rewrite) still works, sign-in/sign-out unaffected.
  4. Any server action (track a fan-out query, accept a suggestion) still works after several navigations.

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/)
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

Soft navigations to /dashboard/prompts (e.g. sidebar Visibility ->
Prompts) still froze after #474: the navigation's RSC request carries
the router state tree through the intl middleware and intermittently
dies server-side with 'The router state header was sent but could not
be parsed' (captured in Vercel function logs; known framework issue for
broad proxy matchers on Vercel, vercel/next.js#91723). The failed
transition then blocks the client's queued server actions, so the
page's data fetch never dispatches.

With a single 'en' locale the only thing next-intl's middleware does
for these requests is the /en rewrite — do that manually for any
request carrying an RSC or Next-Action header and skip the intl
machinery entirely. Auth checks still run first; supabase session
cookies are still forwarded.

Document requests (no RSC header) keep going through next-intl
unchanged.
@gkhngyk
gkhngyk merged commit 847cc43 into main Jul 18, 2026
5 checks passed
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.

1 participant