Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include GraphQL operation name in the unhandled request warning #2161

Open
1 task
vldslv-a opened this issue May 20, 2024 · 3 comments
Open
1 task

Include GraphQL operation name in the unhandled request warning #2161

vldslv-a opened this issue May 20, 2024 · 3 comments
Labels
feature good first issue Good for newcomers

Comments

@vldslv-a
Copy link

Scope

Adds a new behavior

Compatibility

  • This is a breaking change

Feature description

Hello! Previously, in unhandled graphql request errors, you could see the operationName of the query, but at the moment this is not possible. Could you provide an example or a function that would fix this?
image

@kettanaito
Copy link
Member

Hi, @vldslv-a. Thanks for letting us know.

We've removed the parsing of requests from the onUnhandledRequest logic because it's expensive and everybody was paying for it, even if they aren't using GraphQL (there's no way of knowing if a request is a GraphQL request until you attempt to parse it).

I am a bit hesitant to add the parsing back, even if behind an option (not a fan of configurations in general).

Would it be more helpful if we instead printed a stringified request body in the message?

[MSW] Error: intercepted a request without a matching request handler:

  • POST https://app/graphql
    {"query":"query GetUser { ... }","variales":{...}}

Reading the request body is not as expensive and will include the GraphQL request information to help you identify the unhandled request. Let me know!

@kettanaito kettanaito changed the title Getting the OperationName for graphql query Include GraphQL operation name in the unhandled request warning Jun 21, 2024
@vldslv-a
Copy link
Author

Would it be more helpful if we instead printed a stringified request body in the message?

Yes, that would be nice! It would at least give us more information about unhandled requests, because sometimes they are hard to find.

@kettanaito kettanaito added the good first issue Good for newcomers label Jun 21, 2024
@kettanaito
Copy link
Member

@vldslv-a, if you are interested, you can open a pull request with this change! I will help you review the code and merge it for everyone to use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants