strawberry-graphql / strawberry

A GraphQL library for Python that leverages type annotations 🍓
https://strawberry.rocks
MIT License
4.02k stars 533 forks source link

AIOHTTP websocket messages of type "ERROR" not handled correctly #3634

Closed DoctorJohn closed 1 month ago

DoctorJohn commented 2 months ago

Describe the Bug

Both our AIOHTTP implementations of the WS subprotocols currently don't handle AIOHTTP WS messages of type "ERROR" correctly:

Instead, both implementations should return an error to the client and close the connection.

Upvote & Fund

Fund with Polar

DoctorJohn commented 1 month ago

Merging #3638 already solved this issue.

AIOHTTP closes the WebSocket internally with code 1006 (Abnormal Closure) before yielding a message of type "ERROR." Our WebSocket integration code recognizes that the WebSocket has been closed and gracefully stops. Before said PR was merged, our AIOHTTP integration would try to close the WebSocket again because a non-text message (i.e., the message of type "ERROR") was received.