Skip to content

fix(apollo): Do not capture failed requests for empty GraphQL errors arrays - #6285

Merged
lbloder merged 8 commits into
9.x.xfrom
fix/apollo-empty-errors-array
Nov 27, 2026
Merged

lbloder merged 8 commits into
9.x.xfrom
fix/apollo-empty-errors-array

Conversation

@lbloder

@lbloder lbloder commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator

📜 Description

Failed-request detection in the Apollo 3, 4, and 5 integrations now only captures an event when the GraphQL errors array contains at least one entry. Previously the matcher only checked for the opening bracket of an errors array, so a response like {"data": {}, "errors": []} produced a false-positive event.

The detection stays regex-based ("errors"\s*:\s*\[\s*[^\]\s]), tolerant of whitespace and line breaks. Body reading, streaming-response handling, and data collection are unchanged.

Known limitation, unchanged by this PR: a non-empty field named errors nested inside data still matches.

💡 Motivation and Context

Follow-up from #6074 (comment)

💚 How did you test it?

  • Added one test per integration that executes a query returning a multiline empty errors array and verifies no event is captured. The tests failed before the fix because an event was captured.
  • Existing tests with a non-empty errors array continue to verify capture.
  • Updated the Apollo 5 body-reading test fixture from {"errors":[]} to a non-empty array, since those tests expect a capture.
  • ./gradlew :sentry-apollo-3:check :sentry-apollo-4:check :sentry-apollo-5:check

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.

🔮 Next steps

…arrays

Failed-request detection in the Apollo 3, 4, and 5 integrations matched
any `errors` array, including an empty one, which produced false-positive
events. Only match an `errors` array with at least one entry.

Fixes #6194
@linear-code

linear-code Bot commented Oct 19, 2026

Copy link
Copy Markdown

JAVA-758

@sentry

sentry Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.66.0 (1) release

⚙️ sentry-android Build Distribution Settings

@lbloder

lbloder commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator Author

@cursor review

@lbloder

lbloder commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator Author

@sentry review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 435ff85. Configure here.

@lbloder
lbloder marked this pull request as ready for review November 9, 2026 08:32
@lbloder
lbloder requested a review from a team as a code owner November 9, 2026 08:32
@lbloder
lbloder requested review from markushi and runningcode and removed request for a team November 9, 2026 08:32
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR risk: medium

For commit ec4bba1.

Main concerns: data sent to Sentry, reach.

This label is a hint for reviewers, not an approval.

@lbloder
lbloder merged commit 214ba5c into 9.x.x Nov 27, 2026
44 of 45 checks passed
@lbloder
lbloder deleted the fix/apollo-empty-errors-array branch November 27, 2026 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants