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

Error when aborting subscription with µWebSockets.js #3246

Closed
etienneo opened this issue Apr 26, 2024 · 2 comments
Closed

Error when aborting subscription with µWebSockets.js #3246

etienneo opened this issue Apr 26, 2024 · 2 comments

Comments

@etienneo
Copy link

etienneo commented Apr 26, 2024

Describe the bug

When using subscriptions with µWebSockets.js, every time a subscription is aborted by the client, I get the following error log:

Unexpected error while handling request: 
Error: uWS.HttpResponse must not be accessed after uWS.HttpResponse.onAborted callback, or after a successful response. See documentation for uWS.HttpResponse and consult the user manual.
    at forwardResponseBodyToUWSResponse (***/node_modules/@whatwg-node/server/cjs/uwebsockets.js:47:21)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

The problem does not happen when the query is sent as a get parameter, only when the query is sent as post data.

Your Example Website or App

CodeSandbox

Steps to Reproduce the Bug or Issue

From the minimal example attached, doing the following curl and interrupting it will show the error message:

curl --location 'http://0.0.0.0:4000/graphql' \
--header 'Content-Type: application/json' \
--data '{"query":"subscription MySubscription {\n  countdown(from: 10)\n}"}'

With the query as get data (or with the graphiql interface that sends the query as get), the problem won't happen

curl 'http://0.0.0.0:4000/graphql?query=subscription MySubscription{countdown(from:10)}&operationName=MySubscription&extensions={}' \
--header 'Content-Type: application/json'

Expected behavior

These errors, although they don't really impact the client are making it hard to monitor errors server side.

Screenshots or Videos

No response

Platform

  • @graphql-yoga/* version(s): 5.3.0

Additional context

Thanks a lot for your help

@ardatan
Copy link
Collaborator

ardatan commented Apr 26, 2024

Could you update @whatwg-node/node-fetch and @whatwg-node/server packages in your lockfile and try again?
You can find the versions here;
https://github.com/ardatan/whatwg-node/releases/tag/release-1714134977033

@etienneo
Copy link
Author

Thanks a lot @ardatan, that works perfectly for me now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants