Skip to content
This repository was archived by the owner on Oct 23, 2023. It is now read-only.

Latest commit

 

History

History
54 lines (31 loc) · 1.35 KB

File metadata and controls

54 lines (31 loc) · 1.35 KB

Amazon Web Services Lambda

.. default-domain:: py



Installation

To use Sentry with AWS Lambda, you have to install raven as an external dependency. This involves creating a Deployment package and uploading it to AWS.

To install raven into your current project directory:

pip install raven -t /path/to/project-dir

Setup

Create a LambdaClient instance and wrap your lambda handler with the capture_exeptions decorator:

from raven.contrib.awslambda import LambdaClient


client = LambdaClient()

@client.capture_exceptions
def handler(event, context):
    ...
    raise Exception('I will be sent to sentry!')

By default this will report unhandled exceptions and errors to Sentry.

Additional settings for the client are configured using environment variables or subclassing LambdaClient.

The integration was inspired by raven python lambda, another implementation that also integrates with Serverless Framework and has SQS transport support.