-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Only requests using apollo client, Response body of network in sentry session replay is undefined. #8345
Comments
Hi @jabelic, could you provide one or both of:
I don't really see how apollo or similar should affect that, except that the sent payload is not JSON possibly, but we should still capture it as plain text in that case (and have some tests for that...), so not entirely sure what's going on there...! |
Hi @mydea !
Due to confidentiality issues, some properties have been removed or renamed. And here is the response header.
Thank you 😄 |
I had the same problem, so I did some research and found that in sentry-javascript/packages/replay/src/coreHandlers/util/fetchUtils.ts Lines 171 to 177 in a4c858f
I was investigating an issue on apollo-client for such a problem and I found it. apollographql/apollo-client#6769 He seemed to have the same phenomenon with LogRocket, and the cause was that Apollo was sending an abort signal through AbortControler during the cleanup process to cancel all queries whenever a query was completed. apollographql/apollo-client#6769 (comment) I was able to solve this problem at Sentry by taking the same steps described below! apollographql/apollo-client#6769 (comment) const abortController = new AbortController();
const httpLink = createHttpLink({
uri: "http://localhost:4000/graphql",
fetchOptions: {
mode: "cors",
signal: abortController.signal, // here!
},
}); Perhaps you could leave something in the Sentry documentation for troubleshooting when using the apollo-client. |
Hi @ubugeeei , thanks for digging into this and finding a solution! This is awesome, I will see how we can add this to the docs the best way. Thanks a bunch, I'll keep this open until the docs are updated for this! |
@mydea |
Hi, I'm an Apollo Client maintainer. |
Cool, that sounds like a great idea! For reference, this is what we're doing with fetch - we monkey patch it here: https://github.com/getsentry/sentry-javascript/blob/develop/packages/utils/src/instrument.ts#L140 |
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/browser
SDK Version
7.55.2
Framework Version
Nuxt.js: 2.15.8, @apollo/client: 3.5.8
Link to Sentry event
No response
SDK Setup
Steps to Reproduce
When replaying a Sentry session in this environment, the Network response body is undefined.
This problem only occurs for response bodies of API requests using the apollo client response bodies for fetch api requests can be retrieved.
Note that the networkDetailAllowUrls above is a sample, and in my environment, I have set the regular expression to allow only specific APIs to pass through. I have confirmed that the regular expression is correct.
Also, Content-Type of response is application/json.
Expected Result
In the Network tab of the sentry session replay, the response body should be visible.
Actual Result
Response body is undefined in the Network tab of sentry session replay. Response size has been retrieved.
The text was updated successfully, but these errors were encountered: