sentry-python icon indicating copy to clipboard operation
sentry-python copied to clipboard

Invoking a python lambda via SAM results in timeout when Sentry lambda layer is referenced

Open neville1355 opened this issue 3 years ago • 1 comments

How do you use Sentry?

Sentry Saas (sentry.io)

Version

1.9.3

Steps to Reproduce

  1. Add Sentry layer to the cloudformation within a python SAM application
  2. Invoke the lambda via sam invoke local

I have created a sample repo that is purely just the output of the sam init generator with the Sentry lambda layer added to the cloudformation to easily reproduce.

https://github.com/neville1355/sam-app-with-sentry-example

Expected Result

Lambda should execute normally

Actual Result

The lambda always times out no matter what

neville1355 avatar Aug 10 '22 19:08 neville1355

Note that the lambda doesn't timeout in AWS. It only times out when running via sam local invoke which is used for development purposes only.

This is a blocker for us fully adopting Sentry as we can't locally run our lambda code while the lambda layer is being referenced.

neville1355 avatar Aug 10 '22 19:08 neville1355

Hey @neville1355 !

Better late than never. I just ran your repro function with sam locally and it did hang. The thing is that the template references arn:aws:lambda:us-east-1:943013980633:layer:SentryPythonServerlessSDK:33 (Sentry layer version 33).

If I update the later to the latest one (arn:aws:lambda:us-east-1:943013980633:layer:SentryPythonServerlessSDK:80) everything works as excepted.

FYI (or anyone that finds this issue): You can update the the used Sentry layer version of you Lambda functions by going to Sentry.io > Settings > Integrations > AWS Lambda and hit the "Update" button in the UI. See https://docs.sentry.io/product/integrations/cloud-monitoring/aws-lambda/#configure how this looks like.

As this issue has been resolved, I am closing it.

antonpirker avatar Nov 20 '23 13:11 antonpirker