-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Error: Can't set headers after they are sent #471
Comments
@joncursi I was having a similar issue I was able to resolve it by installing |
Can you provide a reduced test case for your setup that throws this error? |
We run into similar issue and rolled back to v1.0.0 for now. It seems to be caused by this change: Our use case that was breaking, is that we had a 404 middleware, however as res.end() was called by GraphQL, the 404 middleware was throwing error. In theory, any middleware that you try to apply to all requests that might be modifying headers will break |
Our app spits the same error after upgrading to 1.0.2 but, surprisingly, it does not break anything. Here is the stack-trace:
Meaningful versions:
|
same for us here ! Thanks the tip |
Here's a small example of the error. Any middleware after your GraphQL endpoint will be run, such as 404 / error handlers. These handlers are also generated as part of the express generator. https://gist.github.com/Friss/90604b5f53ad4bb38146a8f49c730c13 |
We've reverted the patch that caused the problems. I'm very sorry for any inconvinience! |
The problem is still there: #1523 Any hint? |
+1 |
+1 same issue here |
Same here ericmakesapps/graphql-passport#36 |
+1 same issue here |
+1 |
Same issue too I'm trying to write a "Set-Cookie" header in my response object after logging in a user. |
Still encountering this issue.
conf:
|
@alicerocheman Sorry you're running into this, but we won't be able to help without a full reproduction recipe that lets us see it ourselves without any creativity (eg, something starting with |
I faced this issue and I found various examples of this error.
Is this enough to investigate this issue @glasser ? NB: the snipped provided by @porcellus on the SuperTokens issue offer a solution to this problem in their specific use case. Could it be used to solve this more general issue ? |
No, we really need to be given an example that we can run without creativity and see exactly what's happening. (Many of the ones you have linked are from very old versions of Apollo Server — the first one is from Apollo Server v1, I think. The entire way that AS connects to web frameworks has been reworked multiple times since then; if the issue can't be reproduced in AS v4 then there's not much we're going to do.) It sounds like the common thread involves doing some sort of error handling that sends a response; perhaps the error handling is firing in cases where the response has already been sent? |
Every time I make a graphql query from my client, the server console outputs:
The data arrives fine on the client, but I keep getting this error spit out on the server console. It only happens on graphql queries (I'm using Apollo client and Apollo server). I'm not sure where to start since there is no stack trace, so I figured I would start here and see if anyone has any ideas on what's going on!
My server is a Meteor app @
[email protected]
and using themeteor/apollo
integration, so the graphql server is based on express.The text was updated successfully, but these errors were encountered: