-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
Package: serverlessIssues related to the Sentry Serverless SDKIssues related to the Sentry Serverless SDKType: Documentation
Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which package are you using?
@sentry/serverless
SDK Version
Lambda Layer 87 (v7.18.0?)
Framework Version
No response
Link to Sentry event
No response
Steps to Reproduce
Follow steps from here: https://github.com/getsentry/sentry-javascript/tree/master/packages/serverless
Integrate Sentry using internal extension
Another and much simpler way to integrate Sentry to your AWS Lambda function is to add an official layer.
- Choose Layers -> Add Layer.
- Specify an ARN:
arn:aws:lambda:us-west-1:TODO:layer:TODO:VERSION
.- Go to Environment variables and add:
NODE_OPTIONS
:-r @sentry/serverless/cjs/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.
Expected Result
Sentry initializes correctly.
Actual Result
Runtime error during execution:
Error: Cannot find module '@sentry/serverless/cjs/awslambda-auto'
Require stack:
- internal/preload
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at Module._preloadModules (node:internal/modules/cjs/loader:1282:12)
at loadPreloadModules (node:internal/bootstrap/pre_execution:539:5)
at prepareMainThreadExecution (node:internal/bootstrap/pre_execution:85:3)
at node:internal/main/run_main_module:7:1 {
code: 'MODULE_NOT_FOUND',
node:internal/modules/cjs/loader:936
}
I downloaded and inspected the layer, its contents are:
Archive: sentry.zip
creating: relay/
inflating: relay/relay
creating: extensions/
inflating: extensions/sentry-lambda-extension
creating: nodejs/
creating: nodejs/node_modules/
creating: nodejs/node_modules/@sentry/
creating: nodejs/node_modules/@sentry/serverless/
inflating: nodejs/node_modules/@sentry/serverless/package.json
creating: nodejs/node_modules/@sentry/serverless/dist/
linking: nodejs/node_modules/@sentry/serverless/dist/awslambda-auto.js -> ../build/npm/cjs/awslambda-auto.js
creating: nodejs/node_modules/@sentry/serverless/build/
creating: nodejs/node_modules/@sentry/serverless/build/npm/
creating: nodejs/node_modules/@sentry/serverless/build/npm/cjs/
inflating: nodejs/node_modules/@sentry/serverless/build/npm/cjs/awslambda-auto.js
inflating: nodejs/node_modules/@sentry/serverless/build/npm/cjs/index.js
finishing deferred symbolic links:
nodejs/node_modules/@sentry/serverless/dist/awslambda-auto.js -> ../build/npm/cjs/awslambda-auto.js
It looks like the right path is @sentry/serverless/build/npm/cjs/awslambda-auto.js
. We changed it to this, and our Lambda started running.
Metadata
Metadata
Assignees
Labels
Package: serverlessIssues related to the Sentry Serverless SDKIssues related to the Sentry Serverless SDKType: Documentation