<Navbar />
component as a server component.<Navbar />
component I have imported the cookies package from next/headers
in order to get a logged in user's details from the backend using a token from the cookies.app/listings/[id]/page.js
page that contains the generateStaticParams() function, and then my application breaks down with this error:Unhandled Runtime Error
Error: Dynamic server usage: cookies
I have tried all possible solutions but nothing seems to work and I don't understand why this should be an issue. Can anybody explain to me with solutions on why this is so? Thanks in advance
I've been facing the same issue lately and recently found this NextJs Page Maybe this could help Also this is a copy of the question https://github.com/vercel/next.js/issues/49373 You can keep a check here for any updates
Adding export const dynamic = "force-dynamic"
on every page (not component) helped in my case.
The error still sometimes occurs in dev mode and goes away after a page reload, but never occurs in the production build.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With