You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GET-query params are lost when using unstable_getStaticProps in production mode
In DEV-mode when i do request to a page with GET-query parameters, i can read them in unstable_getStaticProps.
Example:
file pages/[category].jsx
...
export async function unstable_getStaticProps({params}) {
// while doing request to http://localhost:8000/items?page=13
// category is always "items"
// "params" is 13 in DEV mode, but undefined in production mode
const {category, page} = params;
}
Meanwhile after build GET-query parameters are not added to params due to code on that line:
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
vercel
locked as resolved and limited conversation to collaborators
Jan 30, 2022
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
GET-query params are lost when using unstable_getStaticProps in production mode
In DEV-mode when i do request to a page with GET-query parameters, i can read them in unstable_getStaticProps.
Example:
Meanwhile after build GET-query parameters are not added to params due to code on that line:
https://github.com/zeit/next.js/blob/88de2328e532eaf0cbb860957f8a5bc2d4c82c44/packages/next/next-server/server/next-server.ts#L917
Judging by the code, GET-query parameters are actually got parsed, but are thrown away.
I checked that out by replacing line
https://github.com/zeit/next.js/blob/88de2328e532eaf0cbb860957f8a5bc2d4c82c44/packages/next/next-server/server/next-server.ts#L919
with code
I am sure that's not the right way to fix it, but it did show to me there's bug in L917.
This is reproducable on next 9.1.4 and canary 9.1.6
The text was updated successfully, but these errors were encountered: