awslabs / dynamodb-data-mapper-js

A schema-based data mapper for Amazon DynamoDB.
https://awslabs.github.io/dynamodb-data-mapper-js/
Apache License 2.0
817 stars 106 forks source link

Unable to create secondary indexes #160

Open KingNoosh opened 5 years ago

KingNoosh commented 5 years ago

https://github.com/awslabs/dynamodb-data-mapper-js/blob/3ffe4bfb9187cf21bf87f72212526fa72172e555/packages/dynamodb-data-mapper/src/DataMapper.ts#L1284

Hey there,

I'm trying to create a table with another index, I see the following from keys:

{ SubjectIdIndex: { id: 'HASH', subjectId: 'RANGE' } }

However the options are undefined, this means when we get to indexOptions, it comes up as undefined because nothing has been passed as the options parameter.

Is there a workaround or a last working version?

Jotakuun commented 5 years ago

I'm having the same problem I'm unable to create a local secondary index, there's nothing about secondary indexes in the documentation and it's frustrating not fiding any information.

I'm following the example provided in this issue but I'm getting the following error Error: No options provided for ItemIdIndex index

hxhieu commented 3 years ago

FYI, if you get Error: No options provided for xxx index, then you can refer to this https://github.com/awslabs/dynamodb-data-mapper-js/issues/193#issuecomment-725719594 It also got me at the beginning i.e. we need to tell the table creation script about the indexes first.