Skip to content
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

[serverless-offline-dynamodb-streams] Error: Cannot find module 'serverless-offline/lambda' #238

Open
amartini93 opened this issue Dec 21, 2022 · 3 comments

Comments

@amartini93
Copy link

I'm getting this error:

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/serverless-offline/lambda' imported from /serverless-offline-dynamodb-streams/src/index.js

Indeed in node_modules in the serverless-offline directory there's no lambda. Do I need to npm install a specific version?

My npm -v is 6.14.17 and
"dependencies": {
"add": "^2.0.6",
"serverless": "^2.46.0",
"serverless-domain-manager": "^6.0.2",
"serverless-offline-dynamodb-streams": "^6.2.3",
"serverless-pseudo-parameters": "^2.5.0",
"serverless-python-requirements": "^5.2.2"
},
"devDependencies": {
"serverless-dynamodb-local": "^0.2.40",
"serverless-offline": "^8.8.0",
"serverless-offline-aws-eventbridge": "^1.6.6",
"serverless-puresec-cli": "^1.2.1",
"serverless-s3-local": "^0.6.18"
}

Also I would like to add a different problem I saw in a closed issue that was closed without solving and asked to reopen, but never did.
Is about using tableName: myTable in the function config.

Serverless: Configuration warning:
Serverless: at 'functions['myfunction'].events[0].stream': unrecognized property 'tableName'

@amartini93
Copy link
Author

I think I might have fixed it replacing line 107 of node_modules/serverless-offline-dynamodb-streams/src/index.js
from:
const {default: Lambda} = await import('serverless-offline/lambda');

to:
const Lambda = require("serverless-offline/dist/lambda").default;

But maybe someone should take a look at it anyway.

@andy-little
Copy link

+1
I get almost the same error:
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lambda' is not defined by "exports" in /node_modules/serverless-offline/package.json imported from /node_modules/serverless-offline-sqs/src/index.js
But @amartini93's suggestion does not work for me.

@pianomansam
Copy link

This isn't enforced, but I believe you need to have Serverless Offline >= 10 for the latest releases of this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants