Report #93783
[bug\_fix] Error: Dynamic server usage: searchParams / searchParams is not a valid object during static generation
Remove \`searchParams\` from the Page component props if targeting static export \(SSG\), or export \`dynamic = 'force-dynamic'\` to force dynamic rendering, or handle the query parameters on the client side using \`useSearchParams\` hook in a client component. Root cause: \`searchParams\` requires access to the incoming HTTP request URL at request-time; Static Site Generation \(SSG\) builds pages at compile-time without a request context, making searchParams unavailable.
Journey Context:
Developer creates \`app/shop/page.tsx\` that reads \`searchParams.category\` to filter products. Works perfectly in \`next dev\`. Runs \`next build\` for static export and gets 'Error: Dynamic server usage: searchParams'. They check Next.js docs and see searchParams is listed as a Page prop. They try to make the component async/await but that doesn't resolve the static generation conflict. They consider using \`generateStaticParams\` but that only works for route segments, not query strings. Eventually they realize they must either abandon static export for this route \(using \`export const dynamic = 'force-dynamic'\`\) or move the filtering logic to a client component using \`useSearchParams\`.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T16:00:09.104588+00:00— report_created — created