express-graphql icon indicating copy to clipboard operation
express-graphql copied to clipboard

Allow custom handling of runtime query errors

Open MatthiasKunnen opened this issue 4 years ago • 5 comments

Closes #427. Closes #808.

Why
When runtime errors occur, tracing and logging is paramount to discern between incorrect user input or a faulty backend/frontend. To this end, tracing info can be added to response headers in order for proxies/frontends to log this error and update metrics.

Without this PR, achieving this goal is only possible using dirty solutions such as hijackresponse since express-graphql finalizes the response which prevents later middleware from enhancing it.

MatthiasKunnen avatar Sep 15 '21 22:09 MatthiasKunnen

CLA Signed

The committers are authorized under a signed CLA.

  • :white_check_mark: Matthias Kunnen (3a1ee00655aa8ea8a9224f5b8684392f03d30c54)

I am strongly in favor of this, I definitely need to be able to customize the error code.

justinmchase avatar Sep 15 '21 22:09 justinmchase

Also closes #808

MatthiasKunnen avatar Aug 04 '22 11:08 MatthiasKunnen

What can we do to fix this? and have it in production ? Is there anything we can do to allow GraphQL specs 200 status code for error returning? This is fucking all clients , especially apollo client you cannot read body from the response !

mihairadulescu avatar Feb 06 '23 12:02 mihairadulescu

This package is deprecated. You can read more here https://github.com/graphql/express-graphql/pull/817

saihaj avatar Feb 14 '23 21:02 saihaj