apollo-server
apollo-server copied to clipboard
fix(promises): avoid unhandledRejection errors
when logger needs to access function context
(e.g. like pino does need)
to fix we must properly bind logger .warn/.error method reference on promise when passing it into .catch()
Hi, this is a small bugfix. We have been seeing a GraphQL Gateway Node process crash with unhandledRejection error when server is under heavy load, couple times a quarter maybe.
Originally I pointed the finger to https://github.com/pinojs/pino/issues/1962 , but the solution is not there.
After discussion, we found potential culprit(s) here. Please review?
@valters: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/
This pull request is automatically built and testable in CodeSandbox.
To see build info of the built libraries, click here or the icon next to each commit SHA.
✅ Docs preview has no changes
The preview was not built because there were no changes.
Build ID: aa34cdb104bc4b05c5ee6200
Good catch!