Skip to content

Initializing Sentry in an AWS Lambda function handler fails with TypeError #3824

Closed as not planned
@pat-youda

Description

@pat-youda

Environment

SaaS (https://sentry.io/)

Steps to Reproduce

  1. Create a Lambda function that initializes Sentry like this:
import sentry_sdk
import sentry_sdk.integrations.aws_lambda as aws_lambda

sentry_sdk.init(
        dsn="...",
        environment="test",
        integrations=[aws_lambda.AwsLambdaIntegration()],
        release="...",
        debug=True
)

requirements.txt:

boto3>=1.35.56,<2
pydantic>=2.9.2,<3
sentry_sdk>=2.19.0,<3

Lambda runtime: Python 3.12

Expected Result

Sentry should be initialized and start capturing errors. In fact, my code works AS IS when run outside AWS Lambda (e.g., on my laptop).

Actual Result

The init method raises a TypeError. Here is the according log statement from CloudWatch:

Image

Product Area

APIs

Link

No response

DSN

No response

Version

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions