Skip to content

fix(vercel): enable ISR passQuery when allowQuery is set - #4790

Merged
pi0 merged 2 commits into
v2from
backport/vercel-isr-query
Oct 15, 2026
Merged

pi0 merged 2 commits into
v2from
backport/vercel-isr-query

Conversation

@pi0x

@pi0x pi0x commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #4408 on v2. Vercel only sends the query string to an ISR function when passQuery is set. With allowQuery alone, every ?lang= value got its own cache entry, but each one held the page rendered without lang. Nitro now writes passQuery: true to .prerender-config.json when the user's allowQuery lists any params, unless passQuery is set explicitly (false is respected). isr: true, routes without allowQuery and an empty allowQuery are unchanged. The JSDoc and Vercel docs are updated, and the same change is made on main in #4792.

I kept the ISR URL restoration changes backported from #4409 and #4599. On real Vercel they didn't change behavior for any request shape we saw, but they're small defensive handling and keep v2's runtime in line with main.

Checked on real Vercel against a v2 baseline. /products/a?lang=es lost lang before and keeps it now. ?lang=es and ?lang=fr are cached separately with the right content. Params not in allowQuery are dropped, __isr_route doesn't leak, and passQuery: false keeps the old behavior.

🤖 Generated with AI assistant

@pi0x
pi0x requested a review from pi0 as a code owner October 15, 2026 08:10
@vercel

vercel Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
nitro.build Ready Ready Preview Oct 15, 2026 9:16am UTC

Request Review

@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 00f7e15f-8645-4b3f-a27b-efcd1f3a3226

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • 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.

@pkg-pr-new

pkg-pr-new Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/nitropack@4790

commit: 825abee

@pi0x
pi0x marked this pull request as draft October 15, 2026 08:35
@pi0x

pi0x commented Oct 15, 2026

Copy link
Copy Markdown
Contributor Author

Moving to draft. An e2e test on a real Vercel deployment showed no difference from v2: with allowQuery only (no passQuery), Vercel invokes the function at the -isr path with no query string and x-now-route-matches carries only the route, so ?lang=es can't be recovered at runtime. With passQuery: true the query already arrives and v2 handles it. The header-plus-query and missing-__isr_route shapes this PR handles never showed up, so the fix for #4408 likely needs a change to the generated route/prerender config instead (main's #4409 is probably affected the same way).

Triaged with AI assistance.

@pi0 pi0 added the v2 label Oct 15, 2026
Also backports the ISR URL restoration runtime changes from #4409 and #4599.
@pi0x
pi0x force-pushed the backport/vercel-isr-query branch from 0ba9d7e to 61ae2e5 Compare October 15, 2026 08:57
@pi0x pi0x changed the title fix(vercel): preserve ISR query params and fall back to request query fix(vercel): enable ISR passQuery when allowQuery is set Oct 15, 2026
@pi0x
pi0x marked this pull request as ready for review October 15, 2026 08:57
@pi0
pi0 merged commit b009ca4 into v2 Oct 15, 2026
12 checks passed
@pi0
pi0 deleted the backport/vercel-isr-query branch October 15, 2026 09:22

This branch was successfully deployed

1 active deployment
Preview — 825abeed Deployed Oct 15, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants