question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

StrawberryShake 13.0.5 is not including GraphQLException Error Details in Reponse

See original GitHub issue

Is 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 StrawberryShake_v12 16 0_Response

After (13.0.5) - generic message without code StrawberryShake_v13 0 5_Response

Steps to reproduce

  1. 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")
        ));
    }
}
  1. Use .AddHttpRequestInterceptor(...) to register the interceptor.
  2. 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:open
  • Created 7 months ago
  • Reactions:5
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
colewernercommented, Mar 28, 2023

I’m having this same issue with graphql requests that are failing. I get a generic 500 internal server error.

1reaction
michaelstaibcommented, Apr 3, 2023

Yes, around 4 weeks until 13.1

Read more comments on GitHub >

github_iconTop Results From Across the Web

Strawberry Shake error about already registered type #4448
I have searched the existing issues Describe the bug When building any project with Strawberry Shake 12.2.2, the following error is ...
Read more >
HC-13.x.x Milestone
Welcome to the home of the Hot Chocolate GraphQL server for . ... StrawberryShake 13.0.5 is not including GraphQLException Error Details in Reponse...
Read more >
c# .net build error due to strawberry shake graphql client ...
I updated strawberry shake 12 to 13 and it removed the issue. Also able to get rid of auto generated models and few...
Read more >
Dealing with errors
GraphQL is strongly typed and so Strawberry validates all queries before executing them. If a query is invalid it isn't executed and instead...
Read more >
C# .Net build failure due to strawberryshake error - Method ...
I was able to found two solutions so far for this issue. Solution 01 - Change azure pipeline yaml 'vmImage' property to 'windows-latest'....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found