Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Digest: DYNAMIC_SERVER_USAGE Nextjs 13

Error Next JS 13

1

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

like image 692
Pierre-Olivier Avatar asked Feb 13 '26 13:02

Pierre-Olivier


1 Answers

I was facing this issue with cookies() Function Issue

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

like image 116
Lonare Avatar answered Feb 23 '26 00:02

Lonare