AWS Lambda

Create a deployment package on your local machine and install the required dependencies in the deployment package. For more information, see Building an AWS Lambda deployment package for Node.js.

Install our Node.js SDK using npm:

$ npm install @sentry/node

To set up Sentry error logging for a Lambda Function, build a wrapper:

"use strict";

const Sentry = require("@sentry/node");

  dsn: "PUBLIC_DSN"

function sentryHandler(lambdaHandler) {
  return async event => {
    try {
      return await lambdaHandler(event);
    } catch (e) {
      await Sentry.flush(2000);
      return e;

module.exports.hello = sentryHandler(async event => {
  return event;

You can obtain the DSN using your Sentry account from your organization's Settings > Projects > Client Keys (DSN) in the Sentry web UI.

Note: You need to call both captureException and flush for captured events to be successfully delivered to Sentry.

Create the deployment package in .zip format, then upload it to AWS Lambda as a Lambda Function. Checkout Sentry's aws sample apps for detailed examples. Refer to the JavaScript docs for more configuration options.

You can edit this page on GitHub.