generateStaticParams with next export: Build fails when generateStaticParams returns an empty array of params #71862
Labels
bug
Issue was opened via the bug report template.
create-next-app
Related to our CLI tool for quickly starting a new Next.js application.
Output (export/standalone)
Related to the the output option in `next.config.js`.
Script (next/script)
Related to Next.js Script Optimization.
Link to the code that reproduces this issue
https://github.com/NasserBvB/generate-static-params-issue
To Reproduce
While building a Next.js application with
output: "export"
innext.config.js
, I encountered an error regarding the missinggenerateStaticParams()
function, despite it being implemented and returning an empty list. This error specifically affects dynamic pages in the project.Notably, the build succeeds as expected when
generateStaticParams()
returns at least one article parameter in the list. The issue only arises when it returns an empty list ([]
).Steps to Reproduce
[email protected]
.articles/[article]/page.js
.generateStaticParams
inarticles/[article]/page.js
and set it to return an empty list ([]
).output: "export"
innext.config.js
.Expected Behavior
The build should succeed without any issues, recognizing that
generateStaticParams()
is implemented and returning an empty list of article slugs.Actual Behavior
An error occurs during the build, specifically stating:
However, when
generateStaticParams()
returns a list with at least one article slug, the build completes successfully as expected.Additional Context
generateStaticParams()
exists inarticles/[article]/page.js
, and the issue persists only when it returns an empty list.Current vs. Expected behavior
Expected Behavior
The build should succeed without any issues, recognizing that
generateStaticParams()
is implemented and returning an empty list of article slugs.Actual Behavior
An error occurs during the build, specifically stating:
However, when
generateStaticParams()
returns a list with at least one article slug, the build completes successfully as expected.Provide environment information
Which area(s) are affected? (Select all that apply)
create-next-app, Output (export/standalone), Script (next/script)
Which stage(s) are affected? (Select all that apply)
next build (local)
Additional context
No response
The text was updated successfully, but these errors were encountered: