AWS Lambda
AWS Lambda is a serverless compute service offered as part of Amazon Web Services. Learn how to set it up with Sentry.
Looking for instructions on how to add Sentry without modifying your code? Check out these docs instead.
On this page you'll get an overview how to install, configure and use Sentry in your AWS Lambda functions. Once set up, our SDK will automatically report error and performance data from your Lambda Functions. Issues in Sentry will automatically include cloudwatch data, function details and execution time measurements.
Depending on your setup, there are different ways to install and use Sentry in your Lambda functions. We recommend one of the following options:
- Install the Sentry AWS Lambda Layer if your Lambda functions are written in CommonJS (CJS) using
require
syntax. - Install the Sentry AWS NPM package if your Lambda functions are running in EcmaScript Modules (ESM) using
import
syntax.
If you're not sure which installation method to use or want an overview of all available options to use Sentry in your Lambda functions, read the installation methods overview.
After installing the SDK, you might want to configure some parameters. Besides the common SDK configuration, you can also configure Sentry's Lambda Function handler wrapper to optimize function runtime overhead and timeout warnings.
Once set up, verify that Sentry is reporting errors correctly by throwing a sample error in one of your functions:
index.js
exports.handler = async (event, context) => {
throw new Error("This is a test error");
};
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").