Skip to content
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

Ensure executionDidEnd hooks are only called once #6846

Merged
merged 3 commits into from Aug 24, 2022

Conversation

trevor-scheer
Copy link
Member

Reproduction in first commit, resolution with test updates in second commit.

executionDidEnd hooks are currently called within both the try and catch clauses of the same block. This means that if a hook throws, they'll be called again in the catch.

Similar to changes made for parsingDidEnd in #6679, we now call the executionDidEnd hooks after the try/catch and within the catch. This ensures they'll only ever be called once.

Fixes #6567

@netlify
Copy link

netlify bot commented Aug 24, 2022

Deploy Preview for apollo-server-docs ready!

Name Link
🔨 Latest commit dd3270c
🔍 Latest deploy log https://app.netlify.com/sites/apollo-server-docs/deploys/63068eb107f71300085bdbba
😎 Deploy Preview https://deploy-preview-6846--apollo-server-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@trevor-scheer trevor-scheer changed the base branch from main to version-4 August 24, 2022 20:44
@codesandbox-ci
Copy link

codesandbox-ci bot commented Aug 24, 2022

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.

Latest deployment of this branch, based on commit dd3270c:

Sandbox Source
Apollo Server Typescript Configuration
Apollo Server Configuration

@glasser
Copy link
Member

glasser commented Aug 24, 2022

Great, and this error will now get sent to unexpectedErrorProcessingRequest instead, right?

@glasser glasser merged commit 2cab8f7 into version-4 Aug 24, 2022
@glasser glasser deleted the trevor/end-hook-errors branch August 24, 2022 23:07
@trevor-scheer
Copy link
Member Author

@glasser right. I forgot we added that hook but probably would've been a good addition to this test. We do still see that code path exercised via the logger call and error that's thrown.

Maybe we just want a few tests for that hook?

@glasser
Copy link
Member

glasser commented Aug 24, 2022

Oops, probably should just have approved rather than merged — good call that more hook tests would be better.

@trevor-scheer
Copy link
Member Author

No worries, opened an issue for myself when I'm back

glasser pushed a commit that referenced this pull request Aug 25, 2022
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 version-4, this PR will be updated.

⚠️⚠️⚠️⚠️⚠️⚠️

`version-4` 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 `version-4`.

⚠️⚠️⚠️⚠️⚠️⚠️

# Releases
## @apollo/server-integration-testsuite@4.0.0-alpha.8

### Patch Changes

-   Updated dependencies \[[`3320fee92`](3320fee), [`9fc23f799`](9fc23f7), [`2cab8f785`](2cab8f7)]:
    -   @apollo/server@4.0.0-alpha.8

## @apollo/server@4.0.0-alpha.8

### Patch Changes

-   [#6841](#6841) [`3320fee92`](3320fee) Thanks [@glasser](https://github.com/glasser)! - Upgrade @apollo/server-gateway-interface to have laxer definition of overallCachePolicy.


-   [#6731](#6731) [`9fc23f799`](9fc23f7) Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Use extensions for all imports to accommodate TS users using moduleResolution: "nodenext"


-   [#6846](#6846) [`2cab8f785`](2cab8f7) Thanks [@trevor-scheer](https://github.com/trevor-scheer)! - Ensure executionDidEnd hooks are only called once (when they throw)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@github-actions github-actions bot mentioned this pull request Oct 10, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle end-hook-thrown errors correctly
2 participants