StrawberryShake 13.0.5 is not including GraphQLException Error Details in Reponse
See original GitHub issueIs there an existing issue for this?
- I have searched the existing issues
Product
Strawberry Shake
Describe the bug
This appears to be related to #5802, but is still happening in 13.0.5.
Background: We were running Hot Chocolate and Strawberry Shake version 12.16.0. We have an IHttpRequestInterceptor for authentication that throws a GraphQLException when our JWT is invalid. We have covered this with several integration tests.
After following your migration documentation to get everything updated to 13.0.5 in both Hot Chocolate and Strawberry Shake, our integration tests around this are now failing because the error is not hydrated in the same was as it was in 12.16.0. You can see in the below screenshots that before the update we got back our specific Error details from the GraphQLException we threw in our interceptor. The Code and Message are populated. After the update, the exact same test only has a generic 500 error message with no code populated.
When we hit the same endpoint with a bad JWT from Banana Cake Pop, we still get all the errors details we expected.
Before (12.16.0) - with Error Code and Message
After (13.0.5) - generic message without code
Steps to reproduce
- Write an IHttpRequestInterceptor that throws a GraphQLException something like this:
public class TestInterceptor : DefaultHttpRequestInterceptor
{
public override async ValueTask OnCreateAsync(
HttpContext context,
IRequestExecutor requestExecutor,
IQueryRequestBuilder requestBuilder,
CancellationToken cancellationToken)
{
await base.OnCreateAsync(context, requestExecutor, requestBuilder, cancellationToken);
throw new GraphQLException(new Error(
"Authentication Failed",
code: "401",
exception: new Exception("Failed to authenticate")
));
}
}
- Use
.AddHttpRequestInterceptor(...)
to register the interceptor. - Make an HTTP request using StrawberryShake and inspect the result. Notice the details from the Error provided to the GraphQL exception are not present.
Relevant log output
No response
Additional Context?
No response
Version
13.0.5
Issue Analytics
- State:
- Created 7 months ago
- Reactions:5
- Comments:8 (2 by maintainers)
Top GitHub Comments
I’m having this same issue with graphql requests that are failing. I get a generic 500 internal server error.
Yes, around 4 weeks until 13.1