Next.js Discord

Discord Forum

Prerendering error

Unanswered
Cuvier’s Dwarf Caiman posted this in #help-forum
Open in Discord
Avatar
Cuvier’s Dwarf CaimanOP
I'm getting this error on page /[id] when building

Error occurred prerendering page "/[id]". Read more: https://nextjs.org/docs/messages/prerender-error
Error: Route "/[id]" has a `generateMetadata` that depends on Request data (`cookies()`, etc...) or external data (`fetch(...)`, etc...) but the rest of the route was static or only used cached data (`"use cache"`). If you expected this route to be prerenderable update your `generateMetadata` to not use Request data and only use cached external data. Otherwise, add `await connection()` somewhere within this route to indicate explicitly it should not be prerendered.
Export encountered an error on /[id]/page: /[id], exiting the build.
 ⨯ Static worker exited with code: 1 and signal: null


I added generateStaticParams as it says here:

https://nextjs.org/docs/app/building-your-application/routing/dynamic-routes#generating-static-params.

But I don't know what is wrong.
Image

3 Replies

Avatar
Cuvier’s Dwarf CaimanOP
I'm using this versions of next and react, testing experimental.dynamicIO
Image
Avatar
you can use "use cache"
Avatar
Cuvier’s Dwarf CaimanOP
I tried before, throws error because of the params
Image