Skip to content

fix(aws): Inject scopes in TimeoutThread exception with AWS lambda - #4914

Merged
alexander-alderman-webb merged 6 commits into
masterfrom
webb/fix-breadcrumbs-on-lambda-timeout
Oct 20, 2025
Merged

alexander-alderman-webb merged 6 commits into
masterfrom
webb/fix-breadcrumbs-on-lambda-timeout

Conversation

@alexander-alderman-webb

@alexander-alderman-webb alexander-alderman-webb commented Oct 10, 2025 •

Copy link
Copy Markdown
Contributor

Description

Missing tags and breadcrumbs on sentry_sdk>=2.26.1 when lambda functions time out are an unintended consequences of 2d392af

You can verify the change with the new unit test.

To test manually:

  1. Clone this repo: https://github.com/getsentry/python-lambda-timeout-repro/tree/main.
  2. If you do not already have the sam cli installed, follow the instructions to install the cli: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/install-sam-cli.html
  3. Stick a DSN in sam-app/hello_world/app.py.
  4. Use your local clone of the SDK in the lambda. In my case, I updated sam-app/hello_world/requirements.txt with
- sentry_sdk==2.26.1
+ /Users/alex/code/sentry-repos/sentry-python

Follow the commands to run the lambda in the README.md of the project. That is, in separate terminals run

sam local start-lambda --debug --template .aws-sam/build/template.yaml
sam local invoke HelloWorldFunction

Issues

More information about how I found the bug are described in #4912.

Closes #4894

Reminders

Comment thread sentry_sdk/utils.py
@alexander-alderman-webb
alexander-alderman-webb marked this pull request as ready for review October 10, 2025 14:49
@alexander-alderman-webb
alexander-alderman-webb requested a review from a team as a code owner October 10, 2025 14:49
cursor[bot]

This comment was marked as outdated.

@sentrivana sentrivana left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, nice!

Comment thread sentry_sdk/utils.py
@sentrivana

Copy link
Copy Markdown
Contributor

We also use TimeoutThread in the GCP integration, might be this is also broken there 👀

@alexander-alderman-webb
alexander-alderman-webb merged commit 1ad7163 into master Oct 20, 2025
111 of 112 checks passed
@alexander-alderman-webb
alexander-alderman-webb deleted the webb/fix-breadcrumbs-on-lambda-timeout branch October 20, 2025 06:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Breadcrumbs and custom tags have stopped working since 2.20

2 participants