ArsenyYankovsky / nova-odm

A schema-based data mapper for Amazon DynamoDB.
https://github.com/ArsenyYankovsky/nova-odm
Apache License 2.0
34 stars 3 forks source link

ScanPaginator and QueryPaginator failing to execute #10

Open gjhommersom opened 8 months ago

gjhommersom commented 8 months ago

I just migrated from AWS SDK v2 to v3 and decided to use this as a replacement for dynamodb-data-mapper-js.

However I get the following error whenever I try to execute a ScanPaginator or QueryPaginator: TypeError: Cannot read properties of undefined (reading '0').

A search on the internet has led me to this: https://stackoverflow.com/questions/68820119/aws-aws-sdk-lib-dynamodb-cannot-read-property-0-of-undefined

Upon checking the sources of this repository I see that the ScanCommand and QueryCommand are indeed imported from @aws-sdk/client-dynamodb instead of @aws-sdk/lib-dynamodb.

My dependencies are:

    "@aws-sdk/client-dynamodb": "^3.462.0",
    "@aws-sdk/lib-dynamodb": "^3.462.0",
    "@nova-odm/query-iterator": "^0.8.7",
gjhommersom commented 8 months ago

I have made a local patch that changes the imports and this fixes the issue.

ArsenyYankovsky commented 8 months ago

Could you please provide an example code? There are tests that run daily for every operation, including scanning.

This library uses @aws-sdk/client-dynamodb as it's the v3 replacement of DynamoDBClient as opposed to using @aws-sdk/lib-dynamodb, which is a replacement of DocumentClient. There should be no need to use @aws-sdk/lib-dynamodb when using nova-odm.