-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Can't set cookies in middleware #7280
Comments
I think this is a bug. Probably we are creating a new instance of AstroCookies when the page is rendered, wiping out your previous sets. Btw, why the |
@matthewp It was set to |
I am faced with the fact that the cookie is being lost.
How to reproduce?
When I log cookie value on /dashboard page with Astro.cookies.get(...).value it's empty. |
Here is the reproduction: https://github.com/i7N3/astro-middleware-bug-reproduction |
@matthewp Should I open a new Issue? |
Yes, please do, thanks! |
What version of
astro
are you using?2.5.6
Are you using an SSR adapter? If so, which one?
Node
What package manager are you using?
npm
What operating system are you using?
Mac
What browser are you using?
Chrome
Describe the Bug
Reading cookies
context.cookies.get(...)
frommiddleware.ts
works fine, but when trying to set a cookiecontext.cookies.set(...)
, it doesn't seem to work.Setting a cookie (using
Astro.cookies
) in a.astro
file does seem to work fine.Am I missing something, or is this a bug?
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-tgbzvq?file=src%2Fmiddleware.ts
Participation
The text was updated successfully, but these errors were encountered: