A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.sentry.io/platforms/javascript/guides/aws-lambda/configuration/lambda-wrapper below:

Lambda Handler Wrapper | Sentry for AWS Lambda

Lambda Handler Wrapper Configure Sentry's Lambda function wrapper

On this page you'll learn about the options to configure the Sentry.wrapHandler wrapper for your Lambda function.

If you're using the AWS Lambda layer with environment variables (i.e. no Sentry code in your function), skip this guide or switch to the initializing the SDK in code.

Flush Timeout

Sentry keeps the lambda function thread alive for up to 2 seconds to ensure reported errors are sent. You can change this flush time limit by defining a flushTimeout value in the handler options:

index.js

Copied

exports.handler = Sentry.wrapHandler(yourHandler, {
});
Timeout Warning

Sentry reports timeout warnings when the Lambda function is within 500ms of the configured Lambda timeout. You can turn off timeout warnings by setting captureTimeoutWarning to false in the handler options.

index.js

Copied

exports.handler = Sentry.wrapHandler(yourHandler, {

captureTimeoutWarning: false,

});

To change the timeout warning limit, assign a numeric value (in ms) to timeoutWarningLimit. This value specifies the time left before the warning is triggered.

index.js

Copied

exports.handler = Sentry.wrapHandler(yourHandler, {

timeoutWarningLimit: 700,

});
Capture Rejected Promises in Promise.allSettled

By default, Sentry captures errors raised by your handler. However, your handler might return a Promise.allSettled result. In this case, even if one of the messages has failed, Sentry won't capture any exception.

The captureAllSettledReasons (default: false) option captures all promise rejected results

Copied

exports.handler = Sentry.wrapHandler(
  () => {
    return Promise.allSettled([
      Promise.rejected(new Error("first")),
      Promise.rejected(new Error("second")),
    ]);
  },
  { captureAllSettledReasons: true },
);

Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4