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
Cookies does not work with Pothos GraphQL & Bun #3114
Comments
Note: It could also be Bun that is the issue here. |
Experiencing the same issue. 😕 Followed this documentation: https://the-guild.dev/graphql/yoga-server/docs/features/cookies |
I can provide some more context: This ways to start the yoga server using graphQL is faulty (and should fail on types). const yoga = createYoga(...)
const server = Bun.serve({
fetch: yoga,
}); Instead one should start the server like: const yoga = createYoga(...)
const server = Bun.serve({
fetch: (req) => yoga(req),
}); I can see that the I will happily make a PR to update some documentation to provide this example for Bun and also look into update typing, if someone can point me in the right direction. |
So if I follow you, this is not in particular linked to Photos ? For now, this workaround seems acceptable, PR are very welcome! For typing, HTTP adapter related types are defined here: https://github.com/ardatan/whatwg-node/blob/master/packages/server/src/types.ts |
@EmrysMyrddin yep, this is solely a Yoga issue when running on Bun (Yoga provides bun snippets for installing packages, so Bun seems to be something that is expected to work). Thanks, I will look at it when I can find some time! |
Hi! Can you try the latest version to see if the problem is still there? It should be fixed now that we have fixed some Bun specific bugs. |
Describe the bug
Using Yogi and Pothos with the recommended cookie plugin from @whatwg-node/server-plugin-cookies gives two bugs:
To reproduce:
Note: If the server is not being restarted, the cookies will stay in all subsequent requests. (we use cookies to store JWTs so that part os obviously critical).
From my perspective it looks like a cache that is not being properly flushed to the client.
The test setup:
Your Example Website or App
https://codesandbox.io/p/devbox/falling-silence-3hphlr
Steps to Reproduce the Bug or Issue
Expected behavior
It is expected that:
Screenshots or Videos
No response
Platform
Additional context
As written, it seems like cookie store is not flushed to the client, but is being persisted in the server.
The text was updated successfully, but these errors were encountered: