Unable to remove @key definition
Note: If your issue/bug is regarding the AWS Amplify Console service, please log it in the Amplify Console GitHub Issue Tracker
Describe the bug A clear and concise description of what the bug is. Trying to remove an @key definition in my model leads to an error: Attempting to mutate more than 1 global secondary index at the same time on the xxx table
Amplify CLI Version
You can use amplify -v to check the amplify cli version on your system
4.29.3
To Reproduce Steps to reproduce the behavior or terminal output if applicable create a model with @key and then remove @key definition
Expected behavior A clear and concise description of what you expected to happen. Expect no errors when a @key is removed
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: [e.g. Mac/Windows/Ubuntu]
- Node Version. You can use
node -vto check the node version on your system Windows, node v14.6
Additional context Add any other context about the problem here.
@frankclaassen Did you try to remove the @key immediately after adding it?
No, this @key has been in the schema for weeks and I have not had any issues with adding / changing keys one at a time until I updated to the latest version of the CLI. This is a new problem. I was able to add a new @key no problem but trying to delete an old @key throws this error. An no, I am not updating multiple GSI's at once, CLI is confused
Tried reverting back to 4.29.2 and same problem still exists
I feel for you Frank. I had a similar problem due to inexperience with Dynamodb and GSI's and had to create a new project. (Not claiming you are inexperienced!) Today I have been very careful pushing changes to my schema making sure to only add one key directive at a time. Its slow going and I did have one instance where I was prompted that add I was adding multiple GSI's when I'm almost certain I didnt. Luckily enough I was able to remove the last @key I added and continue on, nearly had heart failure though. So maybe there is some bug that results in the CLI thinking you are adding or mutating multiple GSI's when you are not..I'm on 4.29.3
@myfairshare yeah, knowing amplify framework is very much still evolving, I have been very careful with adding models & keys and haven't had any issues with it in the 4 months or so I have been using it, which is why this issue is very frustrating. My system is in production, hence I can't afford to scrap the current project and create a new project. Hoping the AWS team will find the issue and resolve it soon.
Do you have only single @key or multiple? If it's the latter then I think this might be related to #5380 I posted a solution there which basically means you can only operate on the last @key for given model. I think a temporary solution for this could be commenting out the @key and not removing the line if its between other @keys but I haven't tested that.
@dsypniewski Yup, seems to be the same problem. Yes, I have multiple @keys on that type and the one I am trying to remove is the first @key defined. I don't want to downgrade to 4.27.3, so will wait for the team to resolve this issue.
@dsypniewski and I tried just commenting the @key out but it gives the same error
Any updates?
@frankclaassen Could you provide a schema to reproduce this? Are you removing @key in only one type?
@SwaySway I was only trying to remove 1 @key, can't remember which key it was anymore as I've added so many new types & keys since opening this issue. Will open a new issue if I experience this problem again
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.