Closed Ronan-V closed 1 month ago
Since this function is executed during the Server Components render pass, I assume that I should be able to call a Server Action which sets my cookie
Nope, during this phase you can not call a Server Action or set a cookie. You can instead set a cookie in the middleware though or alternatively in a Server Action you're calling from the client.
My bad then. Thank you for the quick response !
Description
I need to update a cookie in getRequestConfig. Since this function is executed during the Server Components render pass, I assume that I should be able to call a Server Action which sets my cookie:
However, I get an error telling me that cookies can only be modified in... a Server Action ! Am I wrong somewhere ?
[Error]: Cookies can only be modified in a Server Action or Route Handler
Expected behaviour
Being able to call a Server Action to set a cookie in getRequestConfig.