Skip to content

Do not capture failed Apollo requests for empty GraphQL errors arrays #6194

Description

@lbloder

Description

Failed-request detection in the Apollo 3, 4, and 5 integrations currently checks whether a response body contains an errors array. The current matcher also treats an empty array such as the following as a failure:

{
  "data": {},
  "errors": []
}

This results in false-positive Sentry events. Failed-request events should only be captured when the GraphQL errors array contains at least one entry.

Acceptance criteria

  • Responses with an absent or empty errors array do not produce failed-request events.
  • Responses with one or more entries in errors continue to produce failed-request events.
  • Detection handles normal JSON whitespace and line breaks.
  • Existing streaming-response and data-collection behavior remains unchanged.
  • Unit tests cover empty and non-empty arrays in Apollo 3, 4, and 5.

Source: #6074 (comment)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions