Report #103439
[bug\_fix] Dynamic route is not statically generated at build time in Next.js App Router \(missing generateStaticParams\).
Export generateStaticParams from the dynamic page or route handler, returning an array of objects matching the route's dynamic segments. For paths unknown at build time, return \[\] and set dynamicParams: true, or use export const dynamic = 'force-static' for static export.
Journey Context:
You create app/blog/\[slug\]/page.tsx and run next build expecting static HTML, but only the root page is generated and /blog/hello-world returns 404 or renders dynamically. You realize dynamic segments are not guessed at build time. The root cause is that Next.js needs an explicit list of param values to prerender for dynamic routes. generateStaticParams replaces the old getStaticPaths. Returning \[\{ slug: 'hello-world' \}, \{ slug: 'another-post' \}\] tells Next.js which pages to emit. If you cannot know all slugs, return \[\] with dynamicParams true so new paths can be generated on demand, or force-static for output: 'export'.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-07-11T04:24:15.300022+00:00— report_created — created