-
Notifications
You must be signed in to change notification settings - Fork 2k
fix(promises): avoid unhandledRejection errors #8076
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@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. |
f4e7beb
to
8d6d7a9
Compare
✅ Docs preview has no changesThe preview was not built because there were no changes. Build ID: aa34cdb104bc4b05c5ee6200 |
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()
8d6d7a9
to
0c3b044
Compare
Good catch! |
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ `main` is currently in **pre mode** so this branch has prereleases rather than normal releases. If you want to exit prereleases, run `changeset pre exit` on `main`.⚠️ ⚠️ ⚠️ ⚠️ ⚠️ ⚠️ # Releases ## @apollo/server-gateway-interface@2.0.0-rc.0 ### Major Changes - [#7515](#7515) [`100233a`](100233a) Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Drop support for Node.JS v14, v16, and v20. ## @apollo/server-integration-testsuite@5.0.0-rc.0 ### Major Changes - [#7515](#7515) [`100233a`](100233a) Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Drop support for Node.JS v14, v16, and v20. ### Patch Changes - [#8078](#8078) [`dabe7ba`](dabe7ba) Thanks [@renovate](https://github.com/apps/renovate)! - Support Jest v30 as well as Jest v29. - Updated dependencies \[[`5b26558`](5b26558), [`100233a`](100233a), [`100233a`](100233a), [`100233a`](100233a), [`100233a`](100233a)]: - @apollo/server@5.0.0-rc.0 ## @apollo/server-plugin-response-cache@5.0.0-rc.0 ### Major Changes - [#7515](#7515) [`100233a`](100233a) Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Drop support for Node.JS v14, v16, and v20. ### Patch Changes - [#8076](#8076) [`5b26558`](5b26558) Thanks [@valters](https://github.com/valters)! - Fix some error logs to properly call `logger.error` or `logger.warn` with `this` set. This fixes errors or crashes from logger implementations that expect `this` to be set properly in their methods. - Updated dependencies \[[`5b26558`](5b26558), [`100233a`](100233a), [`100233a`](100233a), [`100233a`](100233a), [`100233a`](100233a)]: - @apollo/server@5.0.0-rc.0 ## @apollo/server@5.0.0-rc.0 ### Major Changes - [#7515](#7515) [`100233a`](100233a) Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Drop support for Node.JS v14, v16, and v20. - [#7515](#7515) [`100233a`](100233a) Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Remove `precomputedNonce` landing page configuration option This option was introduced and subsequently deprecated in v4. Removing this configuration in v4 is strictly an improvement to the security of your landing page, and no longer exists in v5. - [#7515](#7515) [`100233a`](100233a) Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Remove `status400ForVariableCoercionErrors` configuration option; this regression mitigation is now the default behavior in Apollo Server v5. ### Patch Changes - [#8076](#8076) [`5b26558`](5b26558) Thanks [@valters](https://github.com/valters)! - Fix some error logs to properly call `logger.error` or `logger.warn` with `this` set. This fixes errors or crashes from logger implementations that expect `this` to be set properly in their methods. - [#7515](#7515) [`100233a`](100233a) Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - ApolloServerPluginSubscriptionCallback now takes a `fetcher` argument, like the usage and schema reporting plugins. The default value is Node's built-in fetch. - Updated dependencies \[[`100233a`](100233a)]: - @apollo/server-gateway-interface@2.0.0-rc.0 --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: David Glasser <glasser@davidglasser.net>
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @apollo/server-gateway-interface@2.0.0 ### Major Changes - [#7515](#7515) [`100233a`](100233a) Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Drop support for Node.JS v14, v16, and v20. ## @apollo/server-integration-testsuite@5.0.0 ### Major Changes - [#7515](#7515) [`100233a`](100233a) Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Drop support for Node.JS v14, v16, and v20. ### Patch Changes - [#8078](#8078) [`dabe7ba`](dabe7ba) Thanks [@renovate](https://github.com/apps/renovate)! - Support Jest v30 as well as Jest v29. - Updated dependencies \[[`5b26558`](5b26558), [`100233a`](100233a), [`100233a`](100233a), [`100233a`](100233a), [`100233a`](100233a)]: - @apollo/server@5.0.0 ## @apollo/server-plugin-response-cache@5.0.0 ### Major Changes - [#7515](#7515) [`100233a`](100233a) Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Drop support for Node.JS v14, v16, and v20. ### Patch Changes - [#8076](#8076) [`5b26558`](5b26558) Thanks [@valters](https://github.com/valters)! - Fix some error logs to properly call `logger.error` or `logger.warn` with `this` set. This fixes errors or crashes from logger implementations that expect `this` to be set properly in their methods. ## @apollo/server@5.0.0 ### Major Changes - [#7515](#7515) [`100233a`](100233a) Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Drop support for Node.JS v14, v16, and v20. - [#7515](#7515) [`100233a`](100233a) Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Remove `precomputedNonce` landing page configuration option This option was introduced and subsequently deprecated in v4. Removing this configuration in v4 is strictly an improvement to the security of your landing page, and no longer exists in v5. - [#7515](#7515) [`100233a`](100233a) Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Remove `status400ForVariableCoercionErrors` configuration option; this regression mitigation is now the default behavior in Apollo Server v5. ### Patch Changes - [#8076](#8076) [`5b26558`](5b26558) Thanks [@valters](https://github.com/valters)! - Fix some error logs to properly call `logger.error` or `logger.warn` with `this` set. This fixes errors or crashes from logger implementations that expect `this` to be set properly in their methods. - [#7515](#7515) [`100233a`](100233a) Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - ApolloServerPluginSubscriptionCallback now takes a `fetcher` argument, like the usage and schema reporting plugins. The default value is Node's built-in fetch. - Updated dependencies \[[`100233a`](100233a)]: - @apollo/server-gateway-interface@2.0.0 --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: David Glasser <glasser@davidglasser.net>
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 pinojs/pino#1962 , but the solution is not there.
After discussion, we found potential culprit(s) here. Please review?