Error Next JS 13

For some reason when I fetch data in page.tsx I am getting this error : Digest: DYNAMIC_SERVER_USAGE
Fetching data in pages.tsx Using Nextjs 13.1 Data is from supabase 2
It's worth noting that the issue also occurs when trying to use the cookies() function from 'next/headers' in a statically generated page. The cookies() function allows you to access cookies, but when used in the context of static generation, it triggers the same error: "DynamicServerError: Dynamic server usage: headers at staticGenerationBailout"
my code:
import { cookies } from "next/headers";
// with following inside the function
const supabase = createServerComponentClient({ cookies });
reference
So in order to solve this:
I used:
export const dynamic = "force-dynamic";
Just add this line on top of your layout page and you should be ok
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