On an App Router page with a dynamic route, searchParams works in next dev but arrives empty on Vercel production. One reporter logged searchParams on /user/1?test=1 and /blog/1?test=1: present on one route, absent on the other. It does not reproduce locally or via the Vercel CLI. Reported on next 13.4.20-canary.4 and 14.x, even with export const dynamic = 'force-dynamic'. Metadata generation via generateMetadata is hit too.
searchParams is empty in production build on Vercel (App Router, Next.js 13/14)
Two verified causes. First, a maintainer confirmed the expected-behavior case: on statically generated pages (e.g. via generateStaticParams), request-time properties like searchParams are not available, so the object is empty by design. Second, the static-generation tracking gap — where a forwarded searchParams object was dropped instead of triggering dynamic rendering — was fixed in #60645 and shipped in 14.2.0 (verified on canary). Community-verified pitfall: do not name a dynamic route param the same as a query param — a route like /articles/[id] read with ?id=1234 returns undefined for searchParams after deployment even though it works locally; rename either the param or the query key. Source: https://github.com/vercel/next.js/issues/54507