Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

GraphQL ignored-error-types should not rely only on ErrorClassification.toString()

Abierto
#6,020 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
52/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
graphql, java, spring-boot
Área
api, backend

Línea de trabajo

Empieza en SentryGraphqlInstrumentation e inspecciona cómo se compara error.getErrorType().toString() con ignored-error-types. Lee el comportamiento de ErrorClassification.toSpecification(...) de graphql-java y, a continuación, define el enfoque de matching para que ExtendedValidationError pueda ignorarse sin reemplazar el interpolador de mensajes ni depender de toString().

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Feature Java Platform: Java
Problem Statement

I am using the GraphQL integration with:

  • io.sentry:sentry-spring-boot-4
  • io.sentry:sentry-graphql-22
  • Sentry Java SDK 8.42.0
  • com.graphql-java:graphql-java-extended-validation:24.0

I want to ignore expected GraphQL validation errors produced by graphql-java-extended-validation.

The configuration looks like this:

sentry.graphql.ignored-error-types:
  - BAD_REQUEST
  - UNAUTHORIZED
  - FORBIDDEN
  - NOT_FOUND
  - ExtendedValidationError

This works well for enum-like ErrorClassification values, but it does not work reliably for errors from graphql-java-extended-validation.
From what I can see, SentryGraphqlInstrumentation currently resolves the error type with:

error.getErrorType().toString()

and then compares that string with ignoredErrorTypes.
The problem is that graphql-java-extended-validation uses a private ResourceBundleMessageInterpolator.ValidationErrorType class. It does not expose a stable enum-like value via toString(). The semantic classification is exposed through ErrorClassification.toSpecification(...), which returns a map like:

{
  "type": "ExtendedValidationError",
  "validatedPath": [...],
  "constraint": "@..."
}

Because of this, I currently have to work around the issue by replacing the extended-validation MessageInterpolator and returning a custom ErrorClassification whose toString() returns ExtendedValidationError only when called from Sentry:

override fun toString(): String {
    if (stackWalker.callerClass == SentryGraphqlInstrumentation::class.java) {
        return "ExtendedValidationError"
    }

    return super.toString()
}

That workaround is brittle and depends on Sentry internals.
This looks related to #2899, which added easier GraphQL error filtering. The current string-based filtering solves enum-like classifications, but it is hard to use with custom ErrorClassification implementations where toSpecification(...) carries the meaningful classification.

Solution Brainstorm

Could Sentry support a more robust way to classify ignored GraphQL errors?

A few possible approaches:

  1. When error.getErrorType() is present, call errorType.toSpecification(error) and, if it returns a map containing a type field, allow ignored-error-types to match that value.

  2. Add a callback/predicate for GraphQL errors. This would allow applications to inspect GraphQLError, ErrorClassification, extensions, path, etc.

  3. Pass the GraphQLError and/or ErrorClassification through the Sentry Hint, as mentioned in #2899, so users can filter these events in beforeSend without replacing the whole GraphQL instrumentation.

My preference would be option 1 for configuration compatibility, possibly combined with option 3 for advanced filtering.

This would also make the Sentry GraphQL integration work out of the box with graphql-java-extended-validation, which is an official companion library from the graphql-java project. Since Sentry Java already integrates with graphql-java, it would be helpful if expected validation errors from this commonly used library could be ignored without replacing the message interpolator or depending on ErrorClassification.toString().

Lenguaje dominante
Kotlin
Estrellas
1.4k
Forks
478
Merge medio
2 d 20 h
PR fusionados (30 d)
71

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de getsentry/sentry-java

Todos los issues de getsentry/sentry-java

Issues similares

Más issues de Kotlin

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.