Repository navigation
Fix variable batches over WebSocket completing without results - #10825
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No unresolved review issues are identified for the WebSocket variable-batching error-handling changes.
No open issues 🎉
1 file not reviewed
src/HotChocolate/AspNetCore/src/AspNetCore.Pipeline/Properties/AspNetCorePipelineResources.Designer.cs: Generated file
What changed in this PR
This pull request fixes variable-batched GraphQL requests over WebSocket by returning an HC0009 operation error instead of completing without results. The connection remains available for subsequent messages.
Changes:
- Reject variable batching in both supported WebSocket protocols.
- Validate each entry in
graphql-transport-wsrequest batches. - Add centralized error resources and protocol integration tests.
- Update tests to verify that the connection remains open after an error.
- Route new exception paths through the established
ThrowHelperconvention.
| File | Summary |
|---|---|
src/HotChocolate/AspNetCore/test/AspNetCore.Tests/Subscriptions/GraphQLOverWebSocket/WebSocketProtocolTests.cs |
Tests variable-batch rejection, including request-batch entries. The test should also verify that the connection remains usable after the error. |
src/HotChocolate/AspNetCore/test/AspNetCore.Tests/Subscriptions/Apollo/WebSocketProtocolTests.cs |
Tests the Apollo protocol error response. The test should also verify that the connection remains usable after the error. |
src/HotChocolate/AspNetCore/src/AspNetCore.Pipeline/Utilities/ErrorHelper.cs |
Adds the centralized HC0009 variable-batching WebSocket error. |
src/HotChocolate/AspNetCore/src/AspNetCore.Pipeline/Subscriptions/Protocols/GraphQLOverWebSocket/GraphQLOverWebSocketProtocolHandler.cs |
Rejects variable-batched requests for graphql-transport-ws; the new exception path should use a ThrowHelper factory. |
src/HotChocolate/AspNetCore/src/AspNetCore.Pipeline/Subscriptions/Protocols/Apollo/ApolloSubscriptionProtocolHandler.cs |
Rejects variable-batched requests for the Apollo protocol; the new exception path should use a ThrowHelper factory. |
src/HotChocolate/AspNetCore/src/AspNetCore.Pipeline/Properties/AspNetCorePipelineResources.resx |
Defines the localized WebSocket variable-batching error message. |
src/HotChocolate/AspNetCore/src/AspNetCore.Pipeline/Properties/AspNetCorePipelineResources.Designer.cs |
Exposes the generated resource accessor. |
Review effort: Lite
Contributor
Patch coverage100.0% of changed lines covered (17/17)
Project coverage: 59.5% (321536/540819 lines) |
glen-84
added a commit
that referenced
this pull request
Nov 9, 2026
(cherry picked from commit 1a8b3be)
glen-84
added a commit
that referenced
this pull request
Nov 9, 2026
(cherry picked from commit 1a8b3be)
glen-84
added a commit
that referenced
this pull request
Nov 10, 2026
(cherry picked from commit 1a8b3be)
This was referenced Nov 10, 2026
This was referenced Nov 19, 2026
fix(deps): Bump Basic.Reference.Assemblies.Net100 and 32 others
AdCodicem/AdCodicem.ValueObjects#262
Closed
This was referenced Nov 26, 2026
fix(deps): Bump Basic.Reference.Assemblies.Net100 and 43 others
AdCodicem/AdCodicem.ValueObjects#274
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
variablesis a list, sent over WebSocket, completed without delivering any results. Both protocol handlers,graphql-transport-wsandgraphql-ws, now answer it with anerrormessage for the operation: "Variable batching is not supported for WebSocket requests." (HC0009).graphql-transport-wsthis also applies to each entry of a request batch. The connection stays open.Test plan
WebSocketProtocolTestssend a variable batch, and overgraphql-transport-wsalso a request batch with a variable batch entry, and expect the error message. They fail onmain, where the client receivescompleteor no message.HotChocolate.AspNetCore.Subscriptionstests inHotChocolate.AspNetCore.Tests,GatewayBuilderInterceptorTestsinHotChocolate.Fusion.AspNetCore.Tests, and the WebSocket tests inHotChocolate.Fusion.Diagnostics.Tests.