-
Notifications
You must be signed in to change notification settings - Fork 27.5k
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
Error with generateStaticParams
function despite its existence
#57038
Comments
The repro code is missing any returned pages in the generateStaticParams function, for example:
However I agree that the error message is misleading, if a maintainer agrees I could add a PR to improve the error message. |
Thank you for your reply. I completely agree with your observation regarding the error message. I would like to submit a PR to improve the error message. Would that be okay? |
…with `output:export` (#57053) Fixes #57038 # What? Added an error message when `generateStaticParams` returns an empty array with `output:export`. # Why? To provide developers with clear feedback when `generateStaticParams` is not used correctly. # How? Modified the condition checks around the use of `generateStaticParams` to include a check for an empty array and added a corresponding error message. --------- Co-authored-by: Steven <steven@ceriously.com>
…with `output:export` (vercel#57053) Fixes vercel#57038 # What? Added an error message when `generateStaticParams` returns an empty array with `output:export`. # Why? To provide developers with clear feedback when `generateStaticParams` is not used correctly. # How? Modified the condition checks around the use of `generateStaticParams` to include a check for an empty array and added a corresponding error message. --------- Co-authored-by: Steven <steven@ceriously.com>
@viktorronnback what about when the url looks like:
despite my
how should I interpret the error: > Build error occurred
Error: Page "/api/keystatic/[...params]" is missing "generateStaticParams()" so it cannot be used with "output: export" config. |
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Link to the code that reproduces this issue
https://github.com/k-taro56/next-bug-report
To Reproduce
Set up Next.js.
Add
output: 'export'
tonext.config.js
to enable static output.Create a page that allows dynamic routing.
Create the
generateStaticParams
function and make it return an empty array.Run
next build
.Error Message:
Error: Page "/[slug]" is missing "generateStaticParams()" so it cannot be used with "output: export" config.
Current vs. Expected behavior
Current behavior:
An error is raised indicating that the generateStaticParams function does not exist.
Expected Behavior:
The generateStaticParams function should return an array with at least one element.
Verify canary release
Provide environment information
Operating System: Platform: win32 Arch: x64 Version: Windows 11 Home Binaries: Node: 18.18.0 npm: N/A Yarn: N/A pnpm: N/A Relevant Packages: next: 13.5.6-canary.7 eslint-config-next: 13.5.5 react: 18.2.0 react-dom: 18.2.0 typescript: 5.2.2 Next.js Config: output: export
Which area(s) are affected? (Select all that apply)
App Router, Static HTML Export (output: "export")
Additional context
No response
NEXT-1951
The text was updated successfully, but these errors were encountered: