ApolloServerPluginErrorHandler severity mapping transition in Apollo Server 4.0
0 reputation · 03 Feb 2020, 22:09 UTC
Developers building Apollo Server 4.0 applications can use the ApolloServerPluginErrorHandler to centralize error alerts and consolidate visibility across GraphQL operations. The plugin’s onError callback receives an ErrorContext object that includes a severity field, which defaults to 'error' and can be overridden to 'warning' or 'info' to reduce alert volume.
However, the plugin does not prescribe a consistent severity-mapping strategy for distinguishing GraphQL validation errors from runtime resolver exceptions. Additionally, the onError hook lacks built-in support for request-context-aware filtering, such as user authentication status or operation depth, which limits fine-grained noise reduction without custom logic.
What criteria should determine whether a validation failure is logged as 'info' while a resolver exception remains 'error'? Can the onError callback safely access the original request object to conditionally adjust severity based on user role? What is the recommended pattern for routing severity-adjusted alerts to external services like Sentry without introducing silent critical failures?