getsentry/examples

Unable to use the Lambda Layer

Closed this issue · 1 comments

Environment

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

Steps to Reproduce

  1. Using the documentation, I tried adding the sentry layer to my lambda function. The arn provided for eu-west-2 is: arn:aws:lambda:eu-west-2:943013980633:layer:SentryPythonServerlessSDK:24

Expected Result

  1. I expected to run sentry out of the box.

Actual Result

  1. While I am able to initially import the layer, when I go on edit mode, it reads "This layer no longer exists. You must remove this layer from the list before you can save any changes.".
  2. When I try to run import sentry on my lambda function, it says No module named 'sentry'.

I suspect the layer version is incorrect on the documentation but I have been unable to find any information on this.

Ok, so this happened because I was trying to import 'sentry' instead of 'sentry_sdk'.

The correct code is:
import sentry_sdk
from sentry_sdk.integrations.aws_lambda import AwsLambdaIntegration

Hope this helps someone else!