Amplify-cli: amplify push with changing Global Seconadary Indexes for DynamoDB Tables

Created on 12 Feb 2020  路  1Comment  路  Source: aws-amplify/amplify-cli

Note: If your question is regarding the AWS Amplify Console service, please log it in the
official AWS Amplify Console forum

Which Category is your question related to?

amplify push will not let me push when I decide to change up the @key fields to something new in the schema.graphql for updating a DynamoDB Table.

OLD

  @key(
    fields: ["interval", "createdAt"]
    name: "SortByInterval"
    queryField: "listByInterval"
  ) {

NEW

  @key(
    fields: ["uid", "interval", "createdAt"]
    name: "SortByInterval"
    queryField: "listByInterval"
  ) {

I am adding the uid because of the issue I'm getting below. uid is the userId.
https://github.com/aws-amplify/amplify-cli/issues/352

But when I try to amplify push
I get the error below

Attempting to edit the global secondary index SortByInterval on the XXXtable in the XXX stack.
An error occured during the push operation: Attempting to edit the global secondary index SortByInterval on the XXXTable table in the Insight stack.

Amplify CLI Version

You can use amplify -v to check the amplify cli version on your system

4.11

What AWS Services are you utilizing?

Amplify with DynamoDB

@key graphql-transformer question

Most helpful comment

@chantlong This is by design, as DynamoDB does not allow multiple changes on GSIs on one table in one deploy operation.

You've to serialize these kind of changes:

  • Remove the old key
  • Push changes
  • Add the new key
  • Push changes

GSI definition cannot be updated just its properties like provisioned throughput, etc

>All comments

@chantlong This is by design, as DynamoDB does not allow multiple changes on GSIs on one table in one deploy operation.

You've to serialize these kind of changes:

  • Remove the old key
  • Push changes
  • Add the new key
  • Push changes

GSI definition cannot be updated just its properties like provisioned throughput, etc

Was this page helpful?
0 / 5 - 0 ratings