-
Notifications
You must be signed in to change notification settings - Fork 66
API route not passing query string #9
Comments
Hey @wei, great to hear from you again :) Thanks for catching this issue! I'm working on a solution right now 🙂 I'll get back to you very soon! |
Okay, I have some good news: The fix for this is relatively small! Example: https://vigilant-lalande-4e2572.netlify.app/api/debug/12345?testqs=1&works=true Because it changes how things work, I would like to hold this commit back until the release of the upcoming next-on-netlify v2. I need to do a bit more work on a few things, so it may be another week or two until v2 comes out. If you want to have query params right now, you can use the
It has support for query params, but it's not a long-term branch. When I publish v2 of next-on-netlify, I'll notify you here and then delete that branch about ~30 days after. How does that sound? Let's also keep this issue open for now 🙂 |
Thanks for the help!! Sounds great,I'll check it out. 😁 |
Hey @wei, Quick status update: I'm still working on next-on-netlify v2. Support for query string parameters is now fully implemented. And I finally got around to writing tests with Jest and e2e tests with Cypress. You may have noticed that the API endpoint you shared did not have the correct JSON content-type. This was due to In the meantime, I've implemented a work-around for setting the correct headers (and any custom headers, too) by converting I would like tackle issues #2 and #7 before releasing v2, so please bear with me for a bit longer 😁 Hope you're doing well! |
Thanks for keeping me posted! btw it looks like there is an extranuous
in the snippet from the issue you opened on netlify/cli. |
Oops, great catch! Thanks! Fixed that ✔️ |
Thanks for the work you're doing on this! |
- **Breaking: You must change your `netlify.toml` configuration for next-on-netlify v2.0.0.** Please look at the README for the latest configuration. `next-on-netlify` now builds pre-rendered pages and static assets in `out_publish`. Netlify Functions for SSR pages are built to `out_functions`. - Add support for `getStaticProps` (#7) - Add support for `getStaticPaths` with and without fallback (#7) - Add support for `getServerSideProps` (#7) - Query string parameters are now correctly passed to Next Pages and API endpoints (#9) - Response headers are now correctly set (#9) - When a user encounters a 404, `next-on-netlify` now display the NextJS 404 page rather than Netlify's default 404 page. You can customize the NextJS 404 page. (#2) - Every page with server-side rendering is now converted to a stand-alone Netlify Function. Previously, all SSR pages were bundled in a single Netlify Function. - `next-on-netlify` now prints out which pages are being converted to Netlify Functions for SSR, which pages are served as pre-rendered HTML, and the redirects that are being generated. - Adding custom redirects via a `_redirects` file in the project root is no longer supported. Let me know if you want this back. Or define your redirects in `netlify.toml`.
Hey @wei,
Thank you for your bug-hunting (and for catching my typos 😁)! You'll need to make some changes to your # netlify.toml
[build]
command = "npm run build"
functions = "out_functions"
publish = "out_publish"
[dev]
functions = "out_functions"
publish = "out_publish"
framework = "#static" And you will want to adjust your # .gitignore
# Files generated by next-on-netlify command
/out_publish/
/out_functions/
/404.html Let me know if you run into any trouble. I closed this issue for now, but let's reopen it at any time if necessary! And if you build something awesome, let me know, too! I'd love to feature some real-world projects in the README. Happy hacking! 🔥 |
API route is not passing query string.
Repo:
https://github.com/wei/next-on-netlify-demo-wei
Example:
https://relaxed-mirzakhani-568b34.netlify.app/api/debug/12345?testqs=1
Expected output
Actual output
The text was updated successfully, but these errors were encountered: