You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a user issues a typical GraphQL query with subscription type, the expectation is that it will fail gracefully with syntax error if subscription types are not configured. When operation or cost analysis is enabled, the analyzer fails unexpectedly .
This is one scenario I have discovered by trial and error where it fails unexpectedly, not sure if there are other usecases that my end-users are trying out and where it will cause same unhandled failure.
{
"errors": [
{
"message": "Unexpected Execution Error",
"extensions": {
"message": "Unable to cast object of type 'System.Collections.Generic.List`1[System.Linq.Expressions.Expression]' to type 'System.Collections.Generic.List`1[HotChocolate.Execution.Pipeline.Complexity.OperationComplexityAnalyzer]'.",
"stackTrace": " at HotChocolate.Execution.Pipeline.OperationComplexityMiddleware.CompileAnalyzer(IRequestContext requestContext, DocumentNode document, OperationDefinitionNode operationDefinition)\r\n at HotChocolate.Execution.Pipeline.OperationComplexityMiddleware.InvokeAsync(IRequestContext context)\r\n at HotChocolate.Execution.Pipeline.OperationCacheMiddleware.InvokeAsync(IRequestContext context)\r\n at HotChocolate.Execution.Pipeline.DocumentValidationMiddleware.InvokeAsync(IRequestContext context)\r\n at HotChocolate.Execution.Pipeline.DocumentParserMiddleware.InvokeAsync(IRequestContext context)\r\n at HotChocolate.Execution.Pipeline.DocumentCacheMiddleware.InvokeAsync(IRequestContext context)\r\n at HotChocolate.Execution.Pipeline.TimeoutMiddleware.InvokeAsync(IRequestContext context)\r\n at HotChocolate.Execution.Pipeline.ExceptionMiddleware.InvokeAsync(IRequestContext context)"
}
}
]
}
With HC 15.0.3
{
"errors": [
{
"message": "Unexpected Execution Error",
"extensions": {
"message": "The given key '{\r\n books\r\n}' was not present in the dictionary.",
"stackTrace": " at System.Collections.Generic.Dictionary`2.get_Item(TKey key)\r\n at HotChocolate.CostAnalysis.CostAnalyzer.Analyze(OperationDefinitionNode operation, IDocumentValidatorContext context)\r\n at HotChocolate.CostAnalysis.CostAnalyzerMiddleware.TryAnalyze(IRequestContext context, RequestCostOptions requestOptions, CostAnalyzerMode mode, DocumentNode document, String operationId, CostMetrics& costMetrics)\r\n at HotChocolate.CostAnalysis.CostAnalyzerMiddleware.InvokeAsync(IRequestContext context)\r\n at HotChocolate.Execution.Pipeline.DocumentValidationMiddleware.InvokeAsync(IRequestContext context)\r\n at HotChocolate.Execution.Pipeline.DocumentParserMiddleware.InvokeAsync(IRequestContext context)\r\n at HotChocolate.Execution.Pipeline.DocumentCacheMiddleware.InvokeAsync(IRequestContext context)\r\n at HotChocolate.Execution.Pipeline.TimeoutMiddleware.InvokeAsync(IRequestContext context)\r\n at HotChocolate.Execution.Pipeline.ExceptionMiddleware.InvokeAsync(IRequestContext context)"
}
}
]
}
What is expected?
Graceful validation error
What is actually happening?
Unexpected exception in Complexity Analyzer
Relevant log output
Additional context
No response
The text was updated successfully, but these errors were encountered:
Product
Hot Chocolate
Version
12.22.6,15.0.3,14.4.0-p.10
Link to minimal reproduction
https://github.com/vadeveka/hotchocolateexperiments/tree/main
Steps to reproduce
If a user issues a typical GraphQL query with subscription type, the expectation is that it will fail gracefully with syntax error if subscription types are not configured. When operation or cost analysis is enabled, the analyzer fails unexpectedly .
This is one scenario I have discovered by trial and error where it fails unexpectedly, not sure if there are other usecases that my end-users are trying out and where it will cause same unhandled failure.
POST https://localhost:7290/graphql/
{
"query": "subscription {\n books\n}"
}
With HC 12.22.6
With HC 15.0.3
What is expected?
Graceful validation error
What is actually happening?
Unexpected exception in Complexity Analyzer
Relevant log output
Additional context
No response
The text was updated successfully, but these errors were encountered: