Skip to content

Docs: Write cookies from Server Functions #86781

@MartinCura

Description

@MartinCura

What is the documentation issue?

Not sure if i'm wrong or this is a small detail.

Docs for cookies mention many times that cookies can only be mutated by Server Actions or Route Handlers.
https://nextjs.org/docs/app/api-reference/functions/cookies

But we can also do this (.set(), .delete()) from Server Functions in general, right?

I think i'm doing it in my app without problems.

Again maybe a detail but having the word "Action" there so many times threw me off, and i can't think of a way where i architect this flow to use a form action (and corresponding server action) instead of a simple server function (accessed as a normal function from a RSC and as an endpoint from the client).

And maybe there was already an issue about this but i missed it.

Is there any context that might help us understand?

More so, the "Server Actions" links in the cookies docs page all link to a more general page about "Updating data" which talks about Server Functions.

Does the docs page already exist? Please link to it.

https://nextjs.org/docs/app/api-reference/functions/cookies#setting-a-cookie

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions