-
-
Notifications
You must be signed in to change notification settings - Fork 764
fix(vercel): handle isr requests with passQuery: true
#3539
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v2
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
commit: |
passQuery: truepassQuery: true
|
hey @pi0, do you plan to release the fix in upcoming version maybe? |
|
Would love to see this merged. Using works but is not ideal. |
|
The problem I face with https://pkg.pr.new/nitrojs/nitro/nitropack@3539: Building and starting the application with node-presets causes an issue with the public folder resolution in .output Reproduction: https://github.com/fmoessle/nitro-vercel-isr/tree/test-3539-fix results in errors like this: There is no public folder in .output/server/chunks |
Resolves #1880, #3594, #3651
Normally, with ISR matched routes, there is an (undocumented/legacy)
x-now-route-matchesheader that contains the full pathname of the matched route. And Nitro vercel entry uses this header value to restore the original URL, but whenpassQueryisr route rule config is set, this header won't exist anymore, and the path is invalid (isr function name). We cannot always assumeurlquery param is for ISR functions (it can be an actual query in normal routes!)This PR changes the internal
urlquery param to__isr_routeand, if it exists, also attempts to rewrite without relying on legacy header but instead using a runtime protection check to make sure the requested route matches ISR route patterns.We also make sure internal
"__isr_route"is added topassQuery(if specified)Beta testing:
package.json: