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

feat(awslambda,captureAllSettledReasons) : Capture errors individually on sqs partial batch failure #4130

Merged
merged 4 commits into from
Nov 8, 2021
Merged

feat(awslambda,captureAllSettledReasons) : Capture errors individually on sqs partial batch failure #4130

merged 4 commits into from
Nov 8, 2021

Conversation

J4YF7O
Copy link
Contributor

@J4YF7O J4YF7O commented Nov 6, 2021

Before submitting a pull request, please take a look at our
Contributing guidelines and verify:

  • 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).

A lambda can receive up to 1000 messages. (if we use a batchWindow), but it can fail because of 10/1000 messages failed. Tools such as Middy (and the sqs-partial-batch-failure plugin) allow managing this case by deleting records from the queue individually, so that we don't have to retry a record that has already worked.

This PR suggests adding an option to capture all errors coming from a Promise.allSettled. The wrapHandler will not fail the lambda even if there are errors, because I assume that it will be the middy’s job.

J4YM and others added 2 commits November 6, 2021 14:07
…y on sqs partial batch failure

A lambda can receive up to 1000 messages. (if we use a batchWindow), but it can fail because of 10/1000 messages failed. Tools such as [Middy](https://middy.js.org/) (and the `sqs-partial-batch-failure` plugin) allow managing this case by deleting records from the queue individually, so that we don't have to retry a record that has already worked.

This PR suggests adding an option to capture all errors coming from a `Promise.allSettled`. The `wrapHandler` will not fail the lambda even if there are errors, because I assume that it will be the middy’s job.
Copy link
Member

@AbhiPrasad AbhiPrasad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thank you for your contribution! Mind also updating our docs to document captureAllSettledReasons? You can edit this page https://github.com/getsentry/sentry-docs/blob/master/src/platforms/node/guides/aws-lambda/index.mdx.

packages/serverless/src/awslambda.ts Show resolved Hide resolved
@AbhiPrasad AbhiPrasad enabled auto-merge (squash) November 8, 2021 19:27
@AbhiPrasad AbhiPrasad merged commit 89156a4 into getsentry:master Nov 8, 2021
J4YF7O pushed a commit to J4YF7O/sentry-javascript that referenced this pull request Dec 9, 2022
…context for each captured promises

- Following getsentry#4130

# Description

It can be very interesting to build a specific context depending on the error. And especially in my case, the index. This allows to find the corresponding SQSRecord, and to design tags from the body. This increases greatly the debugging capacity, and filtering at the sentry interface level.
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.

None yet

2 participants