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

fix(dynamodb): the maximum number of nonKeyAttributes is 100, not 20 #8186

Merged
merged 1 commit into from
May 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-dynamodb/lib/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1114,9 +1114,9 @@ export class Table extends TableBase {
* @param nonKeyAttributes a list of non-key attribute names
*/
private validateNonKeyAttributes(nonKeyAttributes: string[]) {
if (this.nonKeyAttributes.size + nonKeyAttributes.length > 20) {
if (this.nonKeyAttributes.size + nonKeyAttributes.length > 100) {
// https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html#limits-secondary-indexes
throw new RangeError('a maximum number of nonKeyAttributes across all of secondary indexes is 20');
throw new RangeError('a maximum number of nonKeyAttributes across all of secondary indexes is 100');
}

// store all non-key attributes
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-dynamodb/test/dynamodb.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1114,7 +1114,7 @@ test('error when adding a global secondary index with projection type INCLUDE, b
const table = new Table(stack, CONSTRUCT_NAME, { partitionKey: TABLE_PARTITION_KEY, sortKey: TABLE_SORT_KEY });
const gsiNonKeyAttributeGenerator = NON_KEY_ATTRIBUTE_GENERATOR(GSI_NON_KEY);
const gsiNonKeyAttributes: string[] = [];
for (let i = 0; i < 21; i++) {
for (let i = 0; i < 101; i++) {
gsiNonKeyAttributes.push(gsiNonKeyAttributeGenerator.next().value);
}

Expand All @@ -1124,7 +1124,7 @@ test('error when adding a global secondary index with projection type INCLUDE, b
sortKey: GSI_SORT_KEY,
projectionType: ProjectionType.INCLUDE,
nonKeyAttributes: gsiNonKeyAttributes,
})).toThrow(/a maximum number of nonKeyAttributes across all of secondary indexes is 20/);
})).toThrow(/a maximum number of nonKeyAttributes across all of secondary indexes is 100/);
});

test('error when adding a global secondary index with read or write capacity on a PAY_PER_REQUEST table', () => {
Expand Down