-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
docs(aws): Update guides for v10 Lambda Layer and NPM package #14482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| --- | ||
| title: Installation Methods | ||
| sidebar_order: 1 | ||
| description: "Review all installation methods for using Sentry in AWS Lambda functions" | ||
| --- | ||
|
|
||
| ## Which Installation Method Should I Use? | ||
|
|
||
| Choosing the right installation method for using Sentry in your AWS Lambda functions depends on a couple of factors. | ||
|
|
||
| Lambda functions can be written and executed either in CommonJS, using `require` syntax, or EcmaScript Modules (ESM), using `import` syntax. | ||
| For Sentry to work correctly, you need to follow the guide for the format in which your functions are **executed**. | ||
|
|
||
| ### My Lambda function is written in TypeScript | ||
|
|
||
| If you're using TypeScript, your lambda function is likely transpiled to CommonJS before running it. In this case, follow the [CommonJS instructions](#my-lambda-function-uses-require). | ||
| Note that TypeScript can also be configured to output ESM, in which case you should follow the [ESM instructions](#my-lambda-function-uses-import). | ||
|
|
||
| ### My Lambda function uses `require` | ||
|
|
||
| If you are using `require()` in your function, follow the CommonJS instructions. Choose between [using our Lambda Layer (recommended)](./install/layer__v9.x) or [installing the Sentry AWS NPM package](./install/cjs-npm__v9.x). | ||
|
|
||
| ### 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). | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Incorrect Relative Paths in MDX FileThe |
||
|
|
||
| ### Can I use the Lambda layer for ESM functions? | ||
|
|
||
| At this time, the Lambda Layer is only available for CommonJS functions. If you're using ESM, you'll need to set up Sentry manually. | ||
| We're working on an ESM lambda layer but need to solve several OpenTelemetry-related limitations first. | ||
|
|
||
| ### Should I use the Lambda Layer or the NPM package? | ||
|
|
||
| First off, at this time, you can only use the layer in CommonJS functions. If you're using ESM, you'll need to set up Sentry manually with the NPM package. | ||
|
|
||
| We generally recommend to use the Lambda layer as it doesn't require you to deploy any Sentry dependency alongside your function. | ||
| With using the layer, you can achieve the same level of customization as with the NPM package. | ||
| There are two reasons why you still might want to use the NPM package instead: | ||
|
|
||
| 1. You want to minimize lambda function size and tree-shake parts of the SDK code that you don't need. A related reason might be because you're transpiling your code and want to transpile your dependencies as well. | ||
| 2. You already use NPM packages and deploy `node_modules` with your function and you don't want to add a (or another) Lambda layer to your functions. | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,193 @@ | ||||||
| --- | ||||||
| title: Lambda Layer | ||||||
| description: "Learn how to add the Sentry Node Lambda Layer to use Sentry in your Lambda functions" | ||||||
| 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. | ||||||
|
||||||
| 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| <OnboardingOptionButtons options={["error-monitoring", "performance"]} /> | |
| <OnboardingOptionButtons options={["error-monitoring", "performance", "profiling"]} /> |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| NODE_OPTIONS="-r @sentry/aws-serverless/awslambda-auto" | |
| NODE_OPTIONS="--require @sentry/aws-serverless/awslambda-auto" |
Outdated
There was a problem hiding this comment.
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?
Outdated
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?