Add NO_INTROSPECTION to ApolloServerErrorCode and set the code when throwing #7033
Labels
📚 good-first-issue
Issues that are more approachable for first-time contributors.
🍐 error-handling
Pertaining to error handling (or lack thereof), not just for just general errors/bugs.
When introspection is disabled, a
ValidationRule
is added that will throw aGraphQLError
if an introspection request is received. If you are logging server errors, there can be a lot of noise if someone is attempting to introspect your production servers. To date, we have needed to filter these errors by string matching on the error message, which is not great.Apollo Server v4 introduced the
ApolloServerErrorCode
enum. It would be nice to seeNO_INTROSPECTION
added to this enum and then used as the error.extensions.code when you throw theNoIntrospection
validation rule here:https://github.com/apollographql/apollo-server/blob/main/packages/server/src/ApolloServer.ts#L77
Perhaps add a concrete NoIntrospectionError to internalErrorClasses as well, although that doesn't help someone who would like to use an exported type to check
The text was updated successfully, but these errors were encountered: