next build
output incorrectly reports route as SSG when is uses searchParams
and generateStaticParams
#76507
Labels
Dynamic Routes
Related to dynamic routes.
linear: next
Confirmed issue that is tracked by the Next.js team.
Link to the code that reproduces this issue
https://github.com/migueloller/nextjs-dynamic-route-search-params-ssg-repro
To Reproduce
bun run build
)Current vs. Expected behavior
I expect the output to look like the one below instead:
This can be recreated by commenting out the
generateStaticParams
export.Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 24.3.0: Thu Jan 2 20:24:23 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6020 Available memory (MB): 16384 Available CPU cores: 10 Binaries: Node: 23.7.0 npm: 10.9.2 Yarn: 1.22.21 pnpm: N/A Relevant Packages: next: 15.1.7 // Latest available version is detected (15.1.7). eslint-config-next: 15.1.7 react: 19.0.0 react-dom: 19.0.0 typescript: 5.7.3 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
Not sure
Which stage(s) are affected? (Select all that apply)
next build (local)
Additional context
It seems that the build output marks a page as SSG when it uses
generateStaticParams
even though it actually generates a dynamic route. This can be confirmed by runningnext start
and loading the page—it will show search params even though it shouldn't if the page is static.next build
should probably fail when a page uses dynamic data, likesearchParams
and also usesgenerateStaticParams
.Note, I also used
dynamicParams
to show that if a non-set para is visited, e.g.,/bar
that page still renders. This does not happen is thesearchParams
code is removed.I was also able to use other dynamic APIs, like
await cookies()
and the issue was the same.The text was updated successfully, but these errors were encountered: