graphql-platform
graphql-platform copied to clipboard
Add bug reproduction for @skip and error
It appears that the PathHelper can not construct a path, if the first subselection of the parent field is skipped in Fusion. An error is produced for the following query:
query Test($skip: Boolean!) {
productById(id: "1") {
skippedField @skip(if: $skip)
brand {
errorField
}
}
}
The subgraph resolving the Brand.errorField
produces an error for it. The Resolve node then tries to extract the error from the subgraph and transform it into an error with a proper path. For this it tries to construct the parent path within the Fusion query selection: https://github.com/ChilliCream/graphql-platform/blob/1f04850d8e2a99637e35835b453ea2591a7c2755/src/HotChocolate/Fusion/src/Core/Execution/ExecutionUtils.cs#L512
The PathHelper then throws an exception because a field is uninitialized: https://github.com/ChilliCream/graphql-platform/blob/1f04850d8e2a99637e35835b453ea2591a7c2755/src/HotChocolate/Core/src/Execution/Processing/PathHelper.cs#L96-L103
I assume the skipped field in the middle messes with something, because it will never be initialized if skipped: https://github.com/ChilliCream/graphql-platform/blob/1f04850d8e2a99637e35835b453ea2591a7c2755/src/HotChocolate/Fusion/src/Core/Execution/ExecutionUtils.cs#L64-L67