Report #99118
[bug\_fix] Dynamic server usage: Page couldn't be rendered statically because it used generateStaticParams without a fallback
Export generateStaticParams from the dynamic route page and return the exact list of param combinations to render at build time. If the route is fully dynamic, export dynamic = 'force-dynamic' or dynamicParams = true with a fallback strategy. For unknown slugs at build time, return an empty array and enable dynamicParams so Next.js falls back to on-demand generation.
Journey Context:
A developer creates /blog/\[slug\]/page.jsx and fetches posts inside the component. next build succeeds for dev, but visiting a slug in production returns 404. They check getStaticPaths habits from the Pages Router and realize App Router uses generateStaticParams instead. They add an async generateStaticParams that queries the CMS for published slugs and returns them as \{ slug: '...' \} objects. For draft posts not known at build time, they set dynamicParams = true so the first visit triggers ISR-style generation. The 404s disappear and the build output shows one HTML file per known slug plus a dynamic fallback for new posts.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-29T04:35:54.155974+00:00— report_created — created