Skip to content

serverless: let reject in callbackWrapper call captureExceptionAsync with the error #2958

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

Closed

Conversation

leemhenson
Copy link

Fixes #2956

I modified fakeCallback to not return the supplied error. I don't think you can assume that callbacks will always do that. That exposes the bug in the existing test suites if we add a check:

expect(Sentry.captureException).toBeCalledTimes(1);

Second commit fixes the issue by discarding the callback result and rejecting with the error instead.

  • If you've added code that should be tested, please add tests.
  • Ensure your code lints and the test suite passes (yarn lint) & (yarn test).

@marshall-lee
Copy link
Contributor

I also have a kinda fix for this issue in #2945.
I was forced to take a some different approach but basically it looks similar. The key difference is that there's no need to invoke callback at all since we already coerce the handler to async.

@kamilogorek
Copy link
Contributor

Merged #2945 as it included a lot of other serverless related work. Nonetheless, Really appreciate your contribution @leemhenson. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Synchronous Lambda callback causes undesirable second captureException call
3 participants