Met this issue today, I added two indexes in part of GlobalSecondaryIndexes when defined a dynamodb resource.
Serverless Error ---------------------------------------
An error occurred: TodosDynamoDbTable - Cannot perform more than one GSI creation or deletion in a single update.
The table has been created successfully with previous sls deploy, I got the error after add below codes
move to button on above file, you will see the changes I did.
After I added GlobalSecondaryIndexes (GSI) codes and deploy again, I got the error Cannot perform more than one GSI creation or deletion in a single update.
Remove the whole stack and deploy from beginning is not idea solution, because I don’t expect this behavior in production environment, if I need to change something later.
This does not seem correct. Assuming you want your infrastructure to be fully version controlled, you wouldn’t want to have to “remember” strange deployment procedures like described.
I guess the question to ask is why the second global secondary index has to be registered after the first global secondary index is deployed. Is this because of cloudformation or because of a serverless bug? If it is because of cloudformation, perhaps it is possible to define a DependsOn as a property of the second index? I’m not sure if that would work, but if it does, your deployment procedure would be version controlled again.
hey @alexdebrie1 this issue has been fixed?
I have the same issues and I have more tables with one or 2 indexes.
Its so painful to deploy my serverless project.
Looking forward your help.
Hey @tommedema, @bill, @alexdebrie1 I think this issue should be fixed by AWS team for sure.
By the way, even if CloudFormation doesn’t allow creation or update more than one index or 10 over tables, we can make this working by queueing those requests internally in Serverless framework.
Or we should wait until CloudFormation issue would be fixed?
Why should we keep this strange deployment flow?
Only one way is to serialize the deployment of resources by using DependsOn property, Thanks @tommedema
It works!!!
Hi @harleyguru, I wonder how you used DependsOn to add 2 GSIs in one deployment. I tried the following yaml but met error saying the table “already exists in stack …”:
MyTableResource01:
Type: AWS::DynamoDB::Table
Properties:
TableName: MyTable
[properties … with first GSI]
MyTableResource02:
Type: AWS::DynamoDB::Table
DependsOn:
- MyTableResource01
Properties:
TableName: MyTable
[properties … with second GSI]