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

Fix GraphQL integration swallowing responses #2286

Merged
merged 4 commits into from
Aug 1, 2023

Conversation

sentrivana
Copy link
Contributor

@sentrivana sentrivana commented Aug 1, 2023

For capturing GraphQL responses we're read()ing the HTTPResponse returned by http.client.HTTPConnection.getresponse, which exhausts the payload and it can't be read again by client applications. The original workaround for this was saving the payload in a BytesIO and aliasing HTTPResponse.read to the BytesIO's read. This works when using http.client directly, but stops working with urllib3, which tries to determine whether there's anything left to read by checking if the response is closed, which in turn checks the internal fp file object. By the time we've read() the response, fp is None, and the response appears closed. This PR patches fp to point to the BytesIO saved response.

Fixes #2285

@sentrivana sentrivana marked this pull request as ready for review August 1, 2023 10:44
@sentrivana sentrivana merged commit e918504 into master Aug 1, 2023
244 checks passed
@sentrivana sentrivana deleted the ivana/fix-graphql-swallowing-response branch August 1, 2023 11:02
sentrivana added a commit that referenced this pull request Aug 1, 2023
sentrivana added a commit that referenced this pull request Aug 1, 2023
* Revert "Fix GraphQL integration swallowing responses (#2286)"

This reverts commit e918504.

* Revert "Capture GraphQL client errors (#2243)"

This reverts commit 5199d54.
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

Successfully merging this pull request may close these issues.

Sentry sdk causes requests to return an empty response when using graphql query
2 participants