Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions src/platforms/node/guides/aws-lambda/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,37 @@ exports.handler = Sentry.AWSLambda.wrapHandler(
// `first` and `second` errors are captured
```

### Build a context according to the exception raised

_(New in version ??)_

It is possible to pass a `contextBuilderFn` function which allows to build a SentryContext
according to the error raised by `captureAllSettledReasons`.

```javascript {tabTitle:captureAllSettledReasons}
exports.handler = Sentry.AWSLambda.wrapHandler(
() => {
return Promise.allSettled([
Promise.rejected(new Error("first")),
Promise.rejected(new Error("second")),
]);
},
{
captureAllSettledReasons: {
contextBuilderFn: (
event: SQSEvent | YourLambdaEvent,
reason: Error,
allSettledResultIndex: number
) => {
return { tags: { errorMessage: reason.message } };
},
},
}
);
// `first` and `second` errors are captured,
// the event on sentry will be tagged with the error message (first and second)
```

## Behavior

With the AWS Lambda integration enabled, the Node SDK will:
Expand Down