Hello,
I have done nothing special, no extra configuration or changes. I went through the AWS Lambda integration prompts, waited for the CloudFormation stack to be created, and finalized through sentry.io . After everything was finalized, I ran a lambda function and get the following error.
Cannot find module ‘@sentry /serverless/dist/awslambda-auto’
My understanding is that the integration requires no extra work or code changes to function. So why is there a module import error?
Full error stack:
START RequestId: REDACTED Version: $LATEST
internal/modules/cjs/loader.js:905
throw err;
^
Error: Cannot find module '@sentry/serverless/dist/awslambda-auto'
Require stack:
- internal/preload
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
at Function.Module._load (internal/modules/cjs/loader.js:746:27)
at Module.require (internal/modules/cjs/loader.js:974:19)
at Module._preloadModules (internal/modules/cjs/loader.js:1244:12)
at loadPreloadModules (internal/bootstrap/pre_execution.js:475:5)
at prepareMainThreadExecution (internal/bootstrap/pre_execution.js:72:3)
at internal/main/run_main_module.js:7:1 {
code: 'MODULE_NOT_FOUND',
requireStack: [ 'internal/preload' ]
}
internal/modules/cjs/loader.js:905
throw err;
^
Error: Cannot find module '@sentry/serverless/dist/awslambda-auto'
Require stack:
- internal/preload
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
at Function.Module._load (internal/modules/cjs/loader.js:746:27)
at Module.require (internal/modules/cjs/loader.js:974:19)
at Module._preloadModules (internal/modules/cjs/loader.js:1244:12)
at loadPreloadModules (internal/bootstrap/pre_execution.js:475:5)
at prepareMainThreadExecution (internal/bootstrap/pre_execution.js:72:3)
at internal/main/run_main_module.js:7:1 {
code: 'MODULE_NOT_FOUND',
requireStack: [ 'internal/preload' ]
}
END RequestId: REDACTED
REPORT RequestId: REDACTED Duration: 1339.30 ms Billed Duration: 1340 ms Memory Size: 128 MB Max Memory Used: 11 MB
RequestId: REDACTED Error: Runtime exited with error: exit status 1
Runtime.ExitError
Fixed with updated Sentry lambda layer version. Working now with v65 after simply turning off and on my Lambda functions in the Sentry Lambda integration page.
opened 07:42PM - 18 Apr 22 UTC
closed 11:39AM - 26 Apr 22 UTC
Type: Bug
Status: Fixed
Jira
### Is there an existing issue for this?
- [X] I have checked for existing is… sues https://github.com/getsentry/sentry-javascript/issues
- [X] I have reviewed the documentation https://docs.sentry.io/
- [X] 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
6.19.4
### Framework Version
N/A
### Link to Sentry event
_No response_
### Steps to Reproduce
Cloudformation:
```yaml
Globals:
Function:
Layers:
- !Sub 'arn:aws:lambda:${AWS::Region}:943013980633:layer:SentryNodeServerlessSDK:61'
```
In lambda:
```js
require('@sentry/serverless');
```
I am in `ap-southeast-1` if that matters. Basically 61, 62 fail on an async import. 63 fails on some other import.
### Expected Result
Is functional.
### Actual Result
```
{
"errorType": "Runtime.ImportModuleError",
"errorMessage": "Error: Cannot find module './async'\nRequire stack:\n- /opt/nodejs/node_modules/@sentry/serverless/node_modules/@sentry/utils/build/dist/index.js\n- /opt/nodejs/node_modules/@sentry/serverless/node_modules/@sentry/hub/build/dist/scope.js\n- /opt/nodejs/node_modules/@sentry/serverless/node_modules/@sentry/hub/build/dist/index.js\n- /opt/nodejs/node_modules/@sentry/serverless/node_modules/@sentry/minimal/build/dist/index.js\n- /opt/nodejs/node_modules/@sentry/serverless/node_modules/@sentry/core/build/dist/index.js\n- /opt/nodejs/node_modules/@sentry/serverless/node_modules/@sentry/node/build/dist/index.js\n- /opt/nodejs/node_modules/@sentry/serverless/build/dist/awslambda.js\n- /opt/nodejs/node_modules/@sentry/serverless/build/dist/index.js\n- /var/task/onconnect.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js",
"trace": [
"Runtime.ImportModuleError: Error: Cannot find module './async'",
"Require stack:",
"- /opt/nodejs/node_modules/@sentry/serverless/node_modules/@sentry/utils/build/dist/index.js",
"- /opt/nodejs/node_modules/@sentry/serverless/node_modules/@sentry/hub/build/dist/scope.js",
"- /opt/nodejs/node_modules/@sentry/serverless/node_modules/@sentry/hub/build/dist/index.js",
"- /opt/nodejs/node_modules/@sentry/serverless/node_modules/@sentry/minimal/build/dist/index.js",
"- /opt/nodejs/node_modules/@sentry/serverless/node_modules/@sentry/core/build/dist/index.js",
"- /opt/nodejs/node_modules/@sentry/serverless/node_modules/@sentry/node/build/dist/index.js",
"- /opt/nodejs/node_modules/@sentry/serverless/build/dist/awslambda.js",
"- /opt/nodejs/node_modules/@sentry/serverless/build/dist/index.js",
"- /var/task/onconnect.js",
"- /var/runtime/UserFunction.js",
"- /var/runtime/index.js",
" at _loadUserApp (/var/runtime/UserFunction.js:202:13)",
" at Object.module.exports.load (/var/runtime/UserFunction.js:242:17)",
" at Object.<anonymous> (/var/runtime/index.js:43:30)",
" at Module._compile (internal/modules/cjs/loader.js:1085:14)",
" at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)",
" at Module.load (internal/modules/cjs/loader.js:950:32)",
" at Function.Module._load (internal/modules/cjs/loader.js:790:12)",
" at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12)",
" at internal/main/run_main_module.js:17:47"
]
}
```
system
Closed
May 13, 2022, 3:09am
3
This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.