Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[storage] make it clear that a cookie cannot be set server-side or fix that it cannot be set server-side #626

Open
apatrida opened this issue Apr 29, 2024 · 1 comment

Comments

@apatrida
Copy link

Describe the bug

When creating a cookie using makePersistent, you cannot set the cookie server-side in any way. There is no way to cause the code to set the cookie to be invoked in any way. This is not documented. So cookies must be set client, and can be read server, but not set on the server.

Maybe is due to signals not firing during SSR or fetch events, therefore nothing hears the change in the signal to write the header? And there is no work around to use the same storage to manually write the cookie on the server, you would have to implement it completely independently of the code.

no reproducible case as this can't be shown via stackblitz, no?

Minimal Reproduction Link

https://stackblitz.com/github/solidjs/templates/tree/master/ts?file=src%2Findex.tsx

@atk
Copy link
Member

atk commented Apr 30, 2024

It works out of the box in solid-start in SSR. In other SSR modes, you have to add the getRequestHeaders and getResponseHeaders functions in the options, since classic solid SSR can run on any server and we cannot know which one it will be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants