Fastify example - cannot set cookies
See original GitHub issueHi there,
I am trying out the Fastify example in combination with @fastify/session, basically the equivalent to express-session
. This package sets a cookie on the browser whenever I set a session. However, the cookie does not get set through GraphiQL. Most likely because of the res.raw
that is being used to send the actual result.
Whenever I create a normal endpoint and set a session, the cookie does get set. So it must be something to do with the /graphql endpoint.
I am not too sure if this is an issue with graphql-helix
or with Fastify. I would assume that it has something to do with the sendResult(result, res.raw)
which sends the result without any cookies or something.
Not quite sure, hope someone is able to help me out. Thanks!
Edit: I have also created an issue inside the Fastify repository to make sure that this is not an issue related to graphql-helix
and could be expected behaviour when using res.raw
.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
Top GitHub Comments
@gino https://github.com/contra/graphql-helix/pull/228 Can you try this?
https://github.com/contra/graphql-helix/pull/228#issuecomment-1008959477
It is working fine for me 😇
We are planning to move away from using response.raw for helix, by exposing a Node.js compatible stream API that can be consumed by fastify. https://github.com/fastify/fastify/blob/main/lib/reply.js#L142-L147
Then you can use any fastify plugin with helix!