Report #28859
[bug\_fix] Page with dynamic param '\[slug\]' is missing 'generateStaticParams\(\)' so it cannot be statically generated during export
Implement an async function named generateStaticParams in the dynamic route page file that returns an array of objects, each containing the dynamic segment values \(e.g., return \[\{ slug: 'post-1' \}, \{ slug: 'post-2' \}\]\). If the data is truly dynamic \(unknown at build time\), you cannot use output: 'export' and must use a serverful deployment instead.
Journey Context:
A developer configures next.config.js with output: 'export' to deploy to AWS S3. They create app/blog/\[slug\]/page.tsx that fetches post data from a headless CMS. In development, navigating to /blog/hello-world works perfectly. However, running next build fails with an error indicating the dynamic route cannot be statically generated without generateStaticParams. The developer initially thinks static export means dynamic routes work automatically. After researching, they understand that static export requires knowing every possible URL at build time. They implement generateStaticParams to fetch the list of all blog slugs from the CMS at build time and return them. The build succeeds, generating static HTML for each post. They realize that new posts added to the CMS after the build will not be accessible until the next deployment.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T02:49:53.745081+00:00— report_created — created