Skip to content

Conversation

@msonnb
Copy link
Contributor

@msonnb msonnb commented Jul 29, 2025

Draft: Merge when JS v10 SDKs are released in GA

Introduces new unified docs for ESM and CJS versions of the Lambda layer and NPM package

@msonnb msonnb requested a review from andreiborza July 29, 2025 09:40
@msonnb msonnb self-assigned this Jul 29, 2025
@vercel
Copy link

vercel bot commented Jul 29, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sentry-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 31, 2025 10:36am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
develop-docs ⬜️ Ignored (Inspect) Visit Preview Jul 31, 2025 10:36am

@codecov
Copy link

codecov bot commented Jul 29, 2025

Bundle Report

Changes will increase total bundle size by 4.35kB (0.02%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
sentry-docs-client-array-push 9.85MB -6 bytes (-0.0%) ⬇️
sentry-docs-server-cjs 12.27MB 4.36kB (0.04%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: sentry-docs-server-cjs

Assets Changed:

Asset Name Size Change Total Size Change (%)
1729.js -3 bytes 1.75MB -0.0%
../instrumentation.js -3 bytes 1.08MB -0.0%
9523.js -3 bytes 1.05MB -0.0%
../app/[[...path]]/page.js.nft.json 1.46kB 732.16kB 0.2%
../app/platform-redirect/page.js.nft.json 1.46kB 732.08kB 0.2%
../app/sitemap.xml/route.js.nft.json 1.46kB 729.55kB 0.2%
view changes for bundle: sentry-docs-client-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
static/chunks/pages/_app-*.js -3 bytes 879.71kB -0.0%
static/chunks/1831-*.js -3 bytes 422.23kB -0.0%
server/middleware-*.js 5.55kB 6.55kB 555.3% ⚠️
server/middleware-*.js -5.55kB 1.0kB -84.74%
static/x_X2TmMt6b4iRdWjPklDQ/_buildManifest.js (New) 684 bytes 684 bytes 100.0% 🚀
static/x_X2TmMt6b4iRdWjPklDQ/_ssgManifest.js (New) 77 bytes 77 bytes 100.0% 🚀
static/OwRD1UJpjnMyppMVU6N_t/_buildManifest.js (Deleted) -684 bytes 0 bytes -100.0% 🗑️
static/OwRD1UJpjnMyppMVU6N_t/_ssgManifest.js (Deleted) -77 bytes 0 bytes -100.0% 🗑️

Copy link
Member

@andreiborza andreiborza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also please replace the ESM/CJS functions headings with ESM/CJS Lambda functions just to be a bit more specific?

sidebar_order: 1
---

The easiest way to get started with Sentry is to use the Sentry [Lambda Layer](https://docs.aws.amazon.com/lambda/latest/dg/adding-layers.html) instead of adding `@sentry/aws-serverless` with `npm` or `yarn` manually.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The easiest way to get started with Sentry is to use the Sentry [Lambda Layer](https://docs.aws.amazon.com/lambda/latest/dg/adding-layers.html) instead of adding `@sentry/aws-serverless` with `npm` or `yarn` manually.
The easiest way to get started with Sentry is to use the Sentry [Lambda Layer](https://docs.aws.amazon.com/lambda/latest/dg/adding-layers.html) instead of installing `@sentry/aws-serverless` with a package manager manually.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This screenshot is very pixelated, could you please retake it?

Set the following environment variables in your Lambda function configuration:

```bash {tabTitle:CommonJS}
NODE_OPTIONS="-r @sentry/aws-serverless/awslambda-auto"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
NODE_OPTIONS="-r @sentry/aws-serverless/awslambda-auto"
NODE_OPTIONS="--require @sentry/aws-serverless/awslambda-auto"


![](./img/env_vars.png)

**For ESM functions only:** You'll also need to manually wrap your handler as shown below:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can pack this into an <Alert level="info" title="For ESM functions">, wdyt?

});
```

It's important to add both, the `Sentry.init` call outside the handler function and the `Sentry.wrapHandler` wrapper around your function to automatically catch errors and performance data.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m: It's also important that the Sentry import and init are at the very top of the file and only then having other imports. I think we should also call that out.

We recommend starting the SDK automatically via environment variables so that you only have to make minimal code changes to your lambda function.
If you need more control over the SDK setup, you can also [initialize the SDK in code](#option-b-manual-setup).

However, you need to modify your code and deploy the Sentry dependencies alongside your function code. If you're looking for the most simple way to set up Sentry, you might want to use the [Lambda Layer](../layer) instead.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
However, you need to modify your code and deploy the Sentry dependencies alongside your function code. If you're looking for the most simple way to set up Sentry, you might want to use the [Lambda Layer](../layer) instead.
However, you need to modify your code and deploy the Sentry dependencies alongside your function code. If you're looking for the most simple way to set up Sentry, use the [Lambda Layer](../layer) instead.


Select which Sentry features you'd like to install in addition to Error Monitoring to get the corresponding installation and configuration instructions below.

<OnboardingOptionButtons options={["error-monitoring", "performance"]} />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<OnboardingOptionButtons options={["error-monitoring", "performance"]} />
<OnboardingOptionButtons options={["error-monitoring", "performance", "profiling"]} />

Copy link
Member

@andreiborza andreiborza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!


### My Lambda function uses `import`

If you're using `import` syntax in your function and you're _not_ transpiling the code to CommonJS, follow the [ESM instructions](./install/esm-npm__v9.x).
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Incorrect Relative Paths in MDX File

The index__v9.x.mdx file, located in the install/ directory, contains incorrect relative paths for its internal links. The paths install/layer__v9.x, install/cjs-npm__v9.x, and install/esm-npm__v9.x incorrectly include an extra install/ segment and should be layer__v9.x, cjs-npm__v9.x, and esm-npm__v9.x respectively.

Locations (1)
Fix in Cursor Fix in Web

@andreiborza andreiborza merged commit d641ee2 into master Jul 31, 2025
13 checks passed
@andreiborza andreiborza deleted the ms/aws-esm-lambda-layer branch July 31, 2025 15:35
@github-actions github-actions bot locked and limited conversation to collaborators Aug 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants