Open Metarock opened 1 year ago
export const revalidate = 0;
Adding this on my layout worked for me. I think it's fine?
Edit: This changes all routes to be SSR including any landing pages. So use it either directly on the pages with the issues or on a nested layout.
Just a beginners thought: I believe this is not an issue with Next.js as generateStaticParams
tells NextJS to statically generate the page. But it's detecting that you're using a cookie somewhere in your code making it actually a dynamic page.
Ran into this too when trying to use Posthog on the server, which sets cookies for the id.
It makes sense that the static pages shouldn't support this, but there should still be an easy way to call cookies in a layout, that doesn't impact static pages. Solution might be to use multiple layouts.
Verify canary release
Provide environment information
Which area(s) of Next.js are affected? (leave empty if unsure)
No response
Link to the code that reproduces this issue
Unable to provide
To Reproduce
Describe the Bug
Using
generateStaticParams
with supabase is causing an Unhandled Runtime Error Error: Dynamic server usage: cookiesExpected Behavior
Able to use
generateStaticParams
with supabaseWhich browser are you using? (if relevant)
Firefox 112.0.2(64-bit)
How are you deploying your application? (if relevant)
Vercel