Error: Cannot find module '@aws-sdk/lib-dynamodb/dist-cjs/commands/utils'
Describe the bug
I just created a very simple npm project to test electrodb, and I get the above error. The schemas and code are the same as in the Quickstart page. The only difference is that I'm not using the deprecated aws-sdk package, and instead using @aws-sdk/client-dynamodb.
The problem seems to be with this line: https://github.com/tywalch/electrodb/blob/master/src/client.js#L2
ElectroDB Version 2.14.1
ElectroDB Playground Link .
Entity/Service Definitions Same as the Quickstart.
Expected behavior Expected it to run.
Errors
Here's the full error:
Error: Cannot find module '@aws-sdk/lib-dynamodb/dist-cjs/commands/utils'
Require stack:
- /Users/pablo/Documents/work/projects/personal/test-electrodb/node_modules/electrodb/src/client.js
- /Users/pablo/Documents/work/projects/personal/test-electrodb/node_modules/electrodb/src/entity.js
- /Users/pablo/Documents/work/projects/personal/test-electrodb/node_modules/electrodb/index.js
- /Users/pablo/Documents/work/projects/personal/test-electrodb/entities.ts
- /Users/pablo/Documents/work/projects/personal/test-electrodb/index.ts
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1134:15)
at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/Users/pablo/Documents/work/projects/personal/test-electrodb/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30)
at Function.Module._load (node:internal/modules/cjs/loader:975:27)
at Module.require (node:internal/modules/cjs/loader:1225:19)
at require (node:internal/modules/helpers:177:18)
at Object.<anonymous> (/Users/pablo/Documents/work/projects/personal/test-electrodb/node_modules/electrodb/src/client.js:2:14)
at Module._compile (node:internal/modules/cjs/loader:1356:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
at Object.require.extensions.<computed> [as .js] (/Users/pablo/Documents/work/projects/personal/test-electrodb/node_modules/ts-node/src/index.ts:1608:43)
at Module.load (node:internal/modules/cjs/loader:1197:32) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/pablo/Documents/work/projects/personal/test-electrodb/node_modules/electrodb/src/client.js',
'/Users/pablo/Documents/work/projects/personal/test-electrodb/node_modules/electrodb/src/entity.js',
'/Users/pablo/Documents/work/projects/personal/test-electrodb/node_modules/electrodb/index.js',
'/Users/pablo/Documents/work/projects/personal/test-electrodb/entities.ts',
'/Users/pablo/Documents/work/projects/personal/test-electrodb/index.ts'
]
}
This happens after updating@aws-sdk/lib-dynamodb to version 3.609.0. On version 3.606.0 everything works.
If you need quick solution until issue is fixed just rollback version.
Happened here as well, if you don't use the lib directly just use overrides, pnpm example:
"pnpm": {
"overrides": {
"@aws-sdk/lib-dynamodb": "3.395.0"
}
},
3.395 is the version used by electrodb
Thank you for raising this, I will look into it 👍
I just pushed 2.14.2, @pablote, @sargisshahinyan, and/or @arpadgabor can you confirm whether or not this changes the behavior you see?
works fine with the latest version 👍🏻
Awesome, thanks for patching this asap @tywalch <3