WebSocket parsing issue for connection_error
(graphql_transport_ws
message)
#6138
Labels
connection_error
(graphql_transport_ws
message)
#6138
Describe the bug
Apollo Router tries to handle both WebSocket subprotocols using a single Rust enum --
ServerMessage
. Handling parsing of WebSocket messages from Subgraph regardless of which subprotocol is being used.This
ServerMessage::Error
case is used to deserialize bothtype: error
andtype: connection_error
messages. Based on the way it is written, bothid
andpayload
are required fields.However, in the specification of
graphql_transport_ws
, theconnection_error
message is only described as having apayload
field. Link to protocol.To Reproduce
Steps to reproduce the behavior:
connection_init
message withconnection_error
Expected behavior
connection_error
message with only payload should be able to be parsed correctly, and give an appropriate error message back to the Client initiating the subscription.Output
Response from router
After ad-hoc patch
I modified Apollo Router to add
#[serde(default)]
to the id field, and this was the response I got, which now includes the error from the Subgraph, giving a much better idea to what the underlying issue is.Desktop (please complete the following information):
Was testing with just Explorer interface, not Apollo Client.
Additional context
connection_error
from SubgraphThe text was updated successfully, but these errors were encountered: