#Nextjs refused to read cookies on server component in production build

11 messages · Page 1 of 1 (latest)

tardy igloo
#

Reading cookies (inside server component) in local environment works just fine, but attempting to read it in production build will yield error

1st image: error in production
2nd: sub-root of the app, getClaim is function call
3rd: getClaim implementation, containing cookies() call

desert orchidBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

gloomy lion
#

The error complains you are updating the cookie, not reading it. Do you have such operations somewhere else?

tardy igloo
#

Wait, so reading is ok but modifying it is not?

mystic ore
#

you can't just get cookies in the server and you end up getting them dynamically later

#

It also says

#

Which is basically what you have to do to set cookies

iron perchBOT
# tardy igloo Reading cookies (inside server component) in local environment works just fine, ...
Please add more information to your question

Your question currently does not have sufficient information for people to be able to help. Please add more information to help us help you, for example: relevant code snippets, a reproduction repository, and/or more detailed error messages. See more info on how to ask a good question in https://discord.com/channels/752553802359505017/1138338531983491154 and #welcome message