Skip to content

Timeout warnings from AWS Lambda integration don't include additional context data #1183

@jrojasendava

Description

@jrojasendava

Environment

How do you use Sentry?
Sentry SaaS (sentry.io)

Which SDK and version?

sentry-sdk-1.3.1, Python 3.8.

Sentry client configuration details

I instrumented a Python 3.8 lambda function in AWS Lambda to use the sentry-sdk, along with the aws lambda integration, with code like the following:

import json
import sentry_sdk
from sentry_sdk.integrations.aws_lambda import AwsLambdaIntegration

sentry_sdk.init(
    dsn="https://xxxxxxxxxx@yyyyyy.ingest.sentry.io/zzzzzzzz",
    integrations=[AwsLambdaIntegration(timeout_warning=True)]
)

And I also added an additional context, to send to sentry additional data (the event data that triggered the lambda function I'm instrumenting):

def lambda_handler(event, context):
    sentry_sdk.set_context("lambda_event", dict(event=json.dumps(event)))
    ...

Steps to Reproduce

  1. Run the lambda, and have it time out (run for longer than its configured timeout in the AWS console)
  2. Receive the ServerlessTimeoutWarning awslambda:///lambdaFunctionName warning in the sentry console

Expected Result

I expected the context data I sent right at the start of the function (sentry_sdk.set_context("lambda_event", dict(event=json.dumps(event)))) to be available in the sentry console for this serverless timeout warning message.

Actual Result

The data from the context I added is missing.

Goal I was seeking when I found this issue

My goal is just to receive the event data of the event that triggered the execution of the lambda function. If there's a better way of getting that piece of information (the AWS event which in python lambdas is passed as an argument to the lambda handler function), into the sentry console, for any message sent to sentry, I'm more than happy to change how I collect that info.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions