From 2fa96e664951ab1e4259109cb5d68fd3485e7c7d Mon Sep 17 00:00:00 2001 From: Martin Sonnberger Date: Thu, 11 Sep 2025 17:40:36 +0200 Subject: [PATCH] chore(aws): Update README.md --- packages/aws-serverless/README.md | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/packages/aws-serverless/README.md b/packages/aws-serverless/README.md index 9109b8e059b0..353b702fbcb9 100644 --- a/packages/aws-serverless/README.md +++ b/packages/aws-serverless/README.md @@ -4,21 +4,17 @@

-# Official Sentry SDK for Serverless environments +# Official Sentry SDK for AWS Lambda ## Links -- [Official SDK Docs](https://docs.sentry.io/) +- [Official SDK Docs](https://docs.sentry.io/platforms/javascript/guides/aws-lambda) ## General -This package is a wrapper around `@sentry/node`, with added functionality related to various Serverless solutions. All +This package is a wrapper around `@sentry/node`, with added functionality related to AWS Lambda. All methods available in `@sentry/node` can be imported from `@sentry/aws-serverless`. -Currently supported environment: - -### AWS Lambda - To use this SDK, call `Sentry.init(options)` at the very beginning of your JavaScript file. ```javascript @@ -30,14 +26,14 @@ Sentry.init({ }); // async (recommended) -exports.handler = Sentry.wrapHandler(async (event, context) => { +export const handler = async (event, context) => { throw new Error('oh, hello there!'); -}); +}; // sync -exports.handler = Sentry.wrapHandler((event, context, callback) => { +export const handler = (event, context, callback) => { throw new Error('oh, hello there!'); -}); +}; ``` If you also want to trace performance of all the incoming requests and also outgoing AWS service requests, just set the @@ -46,21 +42,21 @@ If you also want to trace performance of all the incoming requests and also outg ```javascript import * as Sentry from '@sentry/aws-serverless'; -Sentry.AWSLambda.init({ +Sentry.init({ dsn: '__DSN__', tracesSampleRate: 1.0, }); ``` -#### Integrate Sentry using internal extension +#### Integrate Sentry using the Sentry Lambda layer -Another and much simpler way to integrate Sentry to your AWS Lambda function is to add an official layer. +Another much simpler way to integrate Sentry to your AWS Lambda function is to add the official layer. 1. Choose Layers -> Add Layer. -2. Specify an ARN: `arn:aws:lambda:us-west-1:TODO:layer:TODO:VERSION`. +2. Specify an ARN: `arn:aws:lambda:us-west-1:943013980633:layer:SentryNodeServerlessSDKv10:19`. Get the latest ARN from the [docs](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/install/layer). 3. Go to Environment variables and add: - - `NODE_OPTIONS`: `-r @sentry/aws-serverless/build/npm/cjs/awslambda-auto`. + - `NODE_OPTIONS`: `--import @sentry/aws-serverless/awslambda-auto`. - `SENTRY_DSN`: `your dsn`. - `SENTRY_TRACES_SAMPLE_RATE`: a number between 0 and 1 representing the chance a transaction is sent to Sentry. For more information, see - [docs](https://docs.sentry.io/platforms/node/guides/aws-lambda/configuration/options/#tracesSampleRate). + [docs](https://docs.sentry.io/platforms/javascript/guides/aws-lambda/configuration/options/#tracesSampleRate).