Add Sentry As Layer
While you could install Sentry as a dependency in your function, it’s better to add it as a layer. This way you can use it in multiple functions without having to install it in each one.
To do this follow the instruction here:
Sentry Docs > AWS Lambda Layer
Note at the bottom the ability to specify the layer using an ARN. For me the ARN is this:
arn:aws:lambda:us-east-1:943013980633:layer:SentryNodeServerlessSDK:167
Install In Lambda Functions
Follow instructions here:
I prefer not to include the traces option as I haven’t worked out a simple way to detect whether the function is running in dev or prod within the lambdas themselves yet.