-
Notifications
You must be signed in to change notification settings - Fork 89
[Bug]: Query string not populated for getServerSideProps #1068
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
Comments
Hey. Is the log coming from |
The log is coming from the The list of redirects in the build log is truncated and I can't see a way of getting a full list via the Netlify interface. redirects
|
I've downloaded the build from Netlify and these redirects are in the generated [[context.HEAD.redirects]]
from = "/_next/data/xxxxxxxxxxxx/media/:slug.json"
to = "/.netlify/builders/___netlify-odb-handler"
status = 200
[[context.HEAD.redirects]]
from = "/_next/data/xxxxxxxxxxxx/applications/:application.json"
to = "/.netlify/builders/___netlify-odb-handler"
status = 200
[[context.HEAD.redirects]]
from = "/_next/data/xxxxxxxxxxxx/products/:category.json"
to = "/.netlify/builders/___netlify-odb-handler"
status = 200
[[context.HEAD.redirects]]
from = "/_next/data/xxxxxxxxxxxx/:slug.json"
to = "/.netlify/builders/___netlify-odb-handler"
status = 200
[[context.HEAD.redirects]]
from = "/_next/data/xxxxxxxxxxxx/applications/:application/:subapplication.json"
to = "/.netlify/builders/___netlify-odb-handler"
status = 200
[[context.HEAD.redirects]]
from = "/_next/data/xxxxxxxxxxxx/products/:category/:subcategory/:product.json"
to = "/.netlify/builders/___netlify-odb-handler"
status = 200
[[context.HEAD.redirects]]
from = "/_next/data/xxxxxxxxxxxx/vacancies/:slug.json"
to = "/.netlify/builders/___netlify-odb-handler"
status = 200
[[context.HEAD.redirects]]
from = "/_next/data/xxxxxxxxxxxx/products/:category/:subcategory.json"
to = "/.netlify/builders/___netlify-odb-handler"
status = 200
[[context.HEAD.redirects]]
from = "/media/:slug"
to = "/.netlify/builders/___netlify-odb-handler"
status = 200
[[context.HEAD.redirects]]
from = "/applications/:application"
to = "/.netlify/builders/___netlify-odb-handler"
status = 200
[[context.HEAD.redirects]]
from = "/products/:category"
to = "/.netlify/builders/___netlify-odb-handler"
status = 200
[[context.HEAD.redirects]]
from = "/:slug"
to = "/.netlify/builders/___netlify-odb-handler"
status = 200
[[context.HEAD.redirects]]
from = "/applications/:application/:subapplication"
to = "/.netlify/builders/___netlify-odb-handler"
status = 200
[[context.HEAD.redirects]]
from = "/products/:category/:subcategory/:product"
to = "/.netlify/builders/___netlify-odb-handler"
status = 200
[[context.HEAD.redirects]]
from = "/vacancies/:slug"
to = "/.netlify/builders/___netlify-odb-handler"
status = 200
[[context.HEAD.redirects]]
from = "/products/:category/:subcategory"
to = "/.netlify/builders/___netlify-odb-handler"
status = 200
[[context.HEAD.redirects]]
from = "/*"
to = "/.netlify/functions/___netlify-handler"
status = 200 So it looks like this one will be the culprit: [[redirects]]
from = "/:slug"
to = "/.netlify/builders/___netlify-odb-handler"
status = 200 We have We also have some specific pages which are SSR'd like Example pages structure: |
Ok, have a repro for it now: https://github.com/rshackleton/nextjs-query-string-issue No Query String: https://nextjs-query-string-issue.netlify.app/example-ssr-page?test=1 The second link was the build before I added a top-level route for |
That would explain it, yes. Would I be right that There is a workaround though that should work for now. If you add your own rewrites to your [[redirects]]
from = "/search-results"
to = "/.netlify/builders/___netlify-handler"
status = 200
[[redirects]]
from = "/media"
to = "/.netlify/builders/___netlify-handler"
status = 200
|
Me too, so have a good one! I'll put a fix out in the new year. |
@ascorbic just confirming that 4.1.2 fixed this issue for us, thanks for your hard work! |
Great news! Turned out to be a lot more complicated than I'd thought |
Uh oh!
There was an error while loading. Please reload this page.
Summary
When loading a page that is served via SSR (has a
getServerSideProps
export) thecontext.query
object is empty.When running the site locally under dev mode (
next dev
) the query string is populated.When running the site locally after building (
next build
thennext serve
) the query string is populated.It is only after deploying the site to Netlify that the query string is empty.
Steps to reproduce
I've tried to create a repro but I've struggled to replicate the issue outside of our repository. However, I am calling
console.log
on thecontext.query
object at the top of thegetServerSideProps
so I'm not sure what we could be doing to interfere with that outside of some configuration options we're using.The repo is a private repo so I can't share it publicly. I can share log files or other build outputs via a private channel if needed.
A link to a reproduction repository
No response
Plugin version
4.1.1
More information about your build
netlify.toml
)What OS are you using?
Windows
Your netlify.toml file
`netlify.toml`
Your public/_redirects file
`_redirects`
# Paste content of your `_redirects` file here
Your
next.config.js
file`next.config.js`
Builds logs (or link to your logs)
Build logs
Function logs
Function logs
.next JSON files
generated .next JSON files
The text was updated successfully, but these errors were encountered: