Queries returning only errors are forced to be a 500
See original GitHub issueOn commit b3ccce9 a query response containing only the errors
field is forced to be a 500, however these errors could easily be coercion errors due to incorrect input types, thus a bad request and not a server error. I am wondering if there is a strong opinion to keep it this way or if we could improve this logic and potentially make it configurable? A lot of client code that makes graphQL requests often retry on 500 errors and in the case of coercion errors will never succeed.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:26
- Comments:37 (9 by maintainers)
Top Results From Across the Web
Error handling - Apollo GraphQL Docs
If Apollo Server hasn't correctly started up or is in the process of shutting down, it responds with a 500 status code. The...
Read more >How to Fix a 500 Internal Server Error on Your WordPress Site
The 500 Internal Server Error status code occurs when the server encounters an error that prevents it from fulfilling the request.
Read more >Catching a 500 server error in Flask - python - Stack Overflow
I want to catch Python errors when something goes wrong an exception is raised in the code. Is that possible? I should note...
Read more >500 Internal Server Error - HTTP - MDN Web Docs - Mozilla
This error response is a generic "catch-all" response. Usually, this indicates the server cannot find a better 5xx error code to response.
Read more >Should a REST API return a 500 Internal Server Error to ...
500 internal server means "It's our fault, we messed something up", and you should never aim to return this status to a user....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hardcoded 5xx errors made me a little sad, as this might confuse certain GraphQL clients.
This PR doesn’t seem to be exhaustive or about to be merged and I also didn’t feel like maintaining a fork.
I therefore resorted to the next best thing, hijacking the express send handler. 🐴
Usage:
Please note: My inline comment is not meant to be snarky or condescending, I appreciate all open source work ❤️
@acao Since pull request #696 has been reverted in #736, can this issue be re-opened? I could log a new issue but the discussion here is useful history.