Report #53374
[bug\_fix] Page is missing generateStaticParams\(\) so it cannot be prerendered
Export an async function named \`generateStaticParams\` from the dynamic route page file that returns an array of objects, where each object represents the route parameters for one path to be statically generated.
Journey Context:
Developer creates \`app/blog/\[slug\]/page.tsx\` that fetches data based on \`params.slug\`. In \`next dev\`, visiting \`/blog/hello\` works perfectly. They run \`next build\` and it fails with "Error: Page /blog/\[slug\] is missing generateStaticParams\(\) so it cannot be prerendered". They learn that in App Router, Next.js attempts to statically generate all pages at build time by default. For dynamic segments like \`\[slug\]\`, it needs to know the list of valid slugs. They implement \`export async function generateStaticParams\(\) \{ const posts = await getPosts\(\); return posts.map\(p => \(\{ slug: p.slug \}\)\); \}\` in the page file. The build succeeds, generating static HTML for each post. They also learn that if they want to allow slugs not returned by this function, they can export \`dynamicParams = true\` \(default\) to enable ISR/fallback behavior.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T20:05:00.796986+00:00— report_created — created