Next.js Discord

Discord Forum

Getting empty cookies with Fast Refresh

Unanswered
Northeast Congo Lion posted this in #help-forum
Open in Discord
Northeast Congo LionOP
Hi,

When I save a file locally and Next.js performs a fast refresh, I sometimes get an undefined cookie even though I know the cookie is stored. When I perform a full refresh of the page in the browser, I get the cookie again.

It is important to note that I am getting the cookie in a layout when it appears as undefined.

All I am doing is performing this action:

const sessionId = cookies().get(lucia.sessionCookieName)?.value ?? null;


Is there something that I am missing on when it comes to cookies and fast refresh?

Thanks.

0 Replies