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

missing headers (using Fastify) #91

Closed
kireerik opened this issue Jan 19, 2024 · 6 comments
Closed

missing headers (using Fastify) #91

kireerik opened this issue Jan 19, 2024 · 6 comments
Labels
bug Something isn't working help wanted Extra attention is needed released Has been released and published

Comments

@kireerik
Copy link

We are using @fastify/ cors and cookies and the headers are missing when using this library.

If I change this line (

reply.raw.writeHead(init.status, init.statusText, init.headers);
) like this (

    reply.raw.writeHead(init.status, init.statusText, {...reply.getHeaders(), ...init.headers});

) then the cors headers are not missing, but the cookie header is still missing.

@enisdenjo
Copy link
Owner

Hey there, the Cookie header does not come from the server - it comes only from the client (see MDN).

However, a server can send a Set-Cookie header though. Can you try that?

Regarding the rest of the headers, a PR is very welcome - would you consider opening one? Thanks in advance!

@enisdenjo enisdenjo added the bug Something isn't working label Jan 21, 2024
@kireerik
Copy link
Author

kireerik commented Jan 22, 2024

Hi, yes, that's what is not working as well. We are using @fastify/cookie to set a cookie from the server side using Set-Cookie.

Sure, I can for sure create a pull request for the cors case. However the missing Set-Cookie header is a bit unclear for me. I am not sure how should I get it. We set the cookie from a (GraphQL) (mutation) resolver (using @fastify/cookie).

@enisdenjo
Copy link
Owner

Is the set-cookie header present without graphql-sse? Maybe it is not in the getHeaders (you can check that by console logging the results)?

@kireerik
Copy link
Author

kireerik commented Jan 22, 2024

Yes, it is. Yes it is not in the getHeaders.

Anyway. Now we are using the GraphQL Yoga server which (after resolving 2 issues related to it) seems to work as expected.

related issue:

@enisdenjo enisdenjo added the help wanted Extra attention is needed label Jan 26, 2024
enisdenjo pushed a commit that referenced this issue Mar 27, 2024
## [2.5.3](v2.5.2...v2.5.3) (2024-03-27)

### Bug Fixes

* **use/fastify:** Include middleware headers ([134c1b0](134c1b0)), closes [#91](#91)
@enisdenjo
Copy link
Owner

🎉 This issue has been resolved in version 2.5.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

@enisdenjo enisdenjo added the released Has been released and published label Mar 27, 2024
@enisdenjo
Copy link
Owner

Sorry for waiting so long! This issue has been fixed with 134c1b0 and released in v2.5.3. Please check it out, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed released Has been released and published
Projects
None yet
Development

No branches or pull requests

2 participants