-
-
Notifications
You must be signed in to change notification settings - Fork 77
Open
Description
I'm setting a cookie server side. When I check the browser, the cookie is set properly. But when I set the cookie and immediately after that try to get it, it is undefined.
example code:
setCookie(isServer ? ctx : {}, 'testCookie', 'cookie value', {path: '/'});
const testCookie = parseCookies(isServer ? ctx : {}).testCookie;
console.log(testCookie);
The code above logs me undefined. This is happen in getInitialProps in next.js. When I try it client side (same code in ComponentDidMout), everything is working properly.
Is nookies are async when are used server side? How to read the cookie, immediately after set it on server side?
Metadata
Metadata
Assignees
Labels
No labels