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

Operation name not showing with Apollo 4 #1295

Open
cshrivastav007 opened this issue Oct 8, 2024 · 8 comments
Open

Operation name not showing with Apollo 4 #1295

cshrivastav007 opened this issue Oct 8, 2024 · 8 comments

Comments

@cshrivastav007
Copy link

✍️ Describe the bug

After upgrading to Apollo4 the chucker could not discover operation name in graphQl request.

🔧 Expected behavior

Correct operation name should be displayed in chucker app.

📷 Screenshots

Screenshot 2024-10-08 at 10 31 49 PM

📱 Tech info

  • Device: Samsung S23
  • OS: Android 14
  • Chucker version: 4.0.0
@cortinico
Copy link
Member

Oh that's curious. A reproducer would help. Could you share the headers of that request you have on screen @cshrivastav007 ?

@cshrivastav007
Copy link
Author

If you need to verify the operation name header, note that the X-APOLLO-OPERATION-NAME header is no longer available in Apollo version 4.

@cshrivastav007
Copy link
Author

The last Apollo version we were using is 3.8.4 which used to have the operation name in header.
Screenshot 2024-10-09 at 3 44 14 PM

@cortinico
Copy link
Member

If you need to verify the operation name header, note that the X-APOLLO-OPERATION-NAME header is no longer available in Apollo version 4.

Are there no other headers where this information is available?

@cshrivastav007
Copy link
Author

No, I believe it should be added via an interceptor by the host app (from Apollo4). For Chucker, instead of relying on the header, it would be more efficient to set the graphQlOperationName using request.operation.name()

@cortinico
Copy link
Member

using request.operation.name()

Chucker doesn't have access to that method though as we don't know if the user has the Apollo library installed or not. So we'll have to either inspect the body or the headers of the request

@cshrivastav007
Copy link
Author

Ah, I see. Since it's not an Apollo Interceptor, it seems the only option is to retrieve the operation name from the decoded body content, right? 🤔

@cortinico
Copy link
Member

Ah, I see. Since it's not an Apollo Interceptor, it seems the only option is to retrieve the operation name from the decoded body content, right? 🤔

Yeah if there are no other headers, seems like that the preferred way

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants