Open
Description
Describe the bug
use electrodb in a project uses dynamodb v2 sdk, it shows the error.
Error: Cannot find module '@aws-sdk/client-dynamodb'
Require stack:
- /Users/miyamonz/my-project/node_modules/@aws-sdk/lib-dynamodb/dist-cjs/commands/BatchExecuteStatementCommand.js
- /Users/miyamonz/my-project/node_modules/@aws-sdk/lib-dynamodb/dist-cjs/DynamoDBDocument.js
- /Users/miyamonz/my-project/node_modules/@aws-sdk/lib-dynamodb/dist-cjs/index.js
- /Users/miyamonz/my-project/node_modules/electrodb/src/client.js
- /Users/miyamonz/my-project/node_modules/electrodb/src/entity.js
- /Users/miyamonz/my-project/node_modules/electrodb/index.js
ElectroDB Version
2.3.3
Entity/Service Definitions
It seems it's not related to this issue, but just in case.
const handPose = new Entity(
{
model: {
entity: "handPose",
version: "1",
service: "hand",
},
attributes: {
poseId: {
type: "string",
required: true,
readOnly: true,
},
createdAt: {
type: "string",
required: true,
readOnly: true,
default: () => new Date().toISOString(),
},
updatedAt: {
type: "string",
required: true,
default: () => new Date().toISOString(),
},
data: {
type: CustomAttributeType<HandPoseData>("any"),
required: true,
},
},
indexes: {
poses: {
pk: {
field: "pk",
composite: [],
template: `hand#pose`,
},
sk: {
field: "gsipk1",
composite: ["poseId"],
template: "poseId#${poseId}",
},
},
},
},
{ table: TABLE_NAME, client }
);
Expected behavior
it should work with v2 client without installing v3 client.
BTW, installing v3 though I don't use it in my project that uses v2, then the error disappeared, of course,
but importing v2 and v3 causes a type error, so It would be helpful if you could address this issue.
Additional context
Line 1 in 95187d3
I think this line is the problem. it imports v3 client. it should be imported dynamically.
Metadata
Metadata
Assignees
Labels
No labels