Unexpected execution error using Fusion and interface types
Product
Hot Chocolate
Version
13.9.11
Link to minimal reproduction
https://github.com/maartenkools/fusion-bug
Steps to reproduce
Using Fusion, make sure one of the sub graphs implements multiple types based on an interface. When you query those types, and include fields that come from different sub graphs, an error is generated: Unexpected Execution Error. This happens since 13.9.8, while on 13.9.7 it still works.
Also see the projected I've included in the report. It can be tested with the following query:
query Programmes {
programmes {
department {
name
displayName
}
id
... on AdministrativeProgramme {
id
departmentId
}
... on DegreeProgramme {
id
departmentId
}
}
}
What is expected?
A result is returned
What is actually happening?
No result is returned, causing an error
Relevant log output
{
"errors": [
{
"message": "Unexpected Execution Error",
"extensions": {
"message": "A GraphQL result must have data, errors or both.",
"stackTrace": " at HotChocolate.Execution.Processing.ResultBuilder.BuildResult()\r\n at HotChocolate.Fusion.Execution.Nodes.QueryPlan.ExecuteAsync(FusionExecutionContext context, CancellationToken cancellationToken)\r\n at HotChocolate.Fusion.Execution.FederatedQueryExecutor.ExecuteAsync(FusionExecutionContext context, CancellationToken cancellationToken)\r\n at HotChocolate.Fusion.Execution.Pipeline.DistributedOperationExecutionMiddleware.InvokeAsync(IRequestContext context, IBatchDispatcher batchDispatcher)\r\n at HotChocolate.Execution.Pipeline.OperationVariableCoercionMiddleware.InvokeAsync(IRequestContext context)\r\n at HotChocolate.Execution.Pipeline.OperationResolverMiddleware.InvokeAsync(IRequestContext context)\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)"
}
}
]
}
Additional context
No response
I've tested this with HC 14.rc0, and while it no longer produces an unexpected execution error, I do get a different error now:
{
"errors": [
{
"message": "Cannot return null for non-nullable field.",
"locations": [
{
"line": 5,
"column": 13
}
],
"path": [
"programmes",
2,
"department",
"displayName"
],
"extensions": {
"code": "HC0018"
}
},
{
"message": "Cannot return null for non-nullable field.",
"locations": [
{
"line": 5,
"column": 13
}
],
"path": [
"programmes",
1,
"department",
"displayName"
],
"extensions": {
"code": "HC0018"
}
},
{
"message": "Cannot return null for non-nullable field.",
"locations": [
{
"line": 5,
"column": 13
}
],
"path": [
"programmes",
0,
"department",
"displayName"
],
"extensions": {
"code": "HC0018"
}
}
],
"data": null
}
Been doing some debugging with HC 14 p162. The issue occurs in HotChocolate.Fusion.Execution.ExecutionUtils.ComposeResult(). It's trying to resolve a scalar value (string), and retrieves the value fromt data.Single.Element. However, this value is undefined. And the actual data is in data.Multiple twice. Don't know if this helps or not.
OK ... I will have a look at it
@michaelstaib: It was suggested that this issue may be related to the fixed issue in #7937. After testing it with the newest HC15.0.3 this is still affecting the latest HC.
This one is fixed with 15.1.6