Skip to content

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

Draft
lbloder wants to merge 2 commits into
9.x.xfrom
fix/apollo-empty-errors-array
Draft

lbloder wants to merge 2 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.61.0 (1) release

⚙️ sentry-android Build Distribution Settings

This branch has not been deployed

No deployments
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.

1 participant