AWS Lambda Container Image (Node)
You can also add Sentry to your Container Image. To import Sentry's Layer Image, add the following to your Dockerfile:
Copied
COPY --from=public.ecr.aws/sentry/sentry-node-serverless-sdk:<VERSION> /opt/ /opt
Replace VERSION
with a specific version number (for example, 28). You can see a complete list of available versions in Sentry's Amazon ECR repository.
Function Configuration
Set the following environment variables in AWS:
- Set
NODE_OPTIONS
to-r @sentry/serverless/dist/awslambda-auto
- Set
SENTRY_DSN
to your Sentry'sDSNThe Data Source Name (DSN) key tells the Sentry SDK where to send events, ensuring they go to the right project. - Set
SENTRY_TRACES_SAMPLE_RATE
to your preferred sampling rate for transactions
Alternatively, you can also set the environment variables in the Dockerfile:
Copied
ENV NODE_OPTIONS="-r @sentry/serverless/dist/awslambda-auto"
ENV SENTRY_DSN="https://examplePublicKey@o0.ingest.sentry.io/0"
ENV SENTRY_TRACES_SAMPLE_RATE="1.0"
The values you set in AWS override the value in the Dockerfile if both are set.
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) to suggesting an update ("yeah, this would be better").
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) to suggesting an update ("yeah, this would be better").
- Package:
- npm:@sentry/node
- Version:
- 7.72.0
- Repository:
- https://github.com/getsentry/sentry-javascript