@lamware/sentry
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published
NPM Discord Apache-2.0

Lamware - Sentry

This Lamware Middleware utilizes the Sentry Serverless SDK to automatically initialize and wrap your Lambda Function handler to capture errors and report them to Sentry.

Installation

This package is available via NPM:

yarn add @lamware/sentry

# or

npm install @lamware/sentry

Usage

import type { APIGatewayProxyHandlerV2 } from 'aws-lambda';
import { sentry } from '@lamware/sentry';
import { lamware } from '@lamware/core';

const { handler } = lamware<APIGatewayProxyHandlerV2<any>>()
  .use(sentry({
    // You can provide config directly to the SDK `init()`.
    config: {
      dsn: 'your-sentry-dsn-here',
    },
    // You can also optionally provide options to the wrapper.
    wrapper: {
      callbackWaitsForEmptyEventLoop: false,
    },
  }))
  .execute(async () => {
    return { statusCode: 200 };
  });

export { handler };

Package Sidebar

Install

npm i @lamware/sentry

Weekly Downloads

31

Version

2.0.1

License

GPL-3.0-only

Unpacked Size

39.6 kB

Total Files

7

Last publish

Collaborators

  • oyed