Switching ENVs does not clear #current-cloud-backend
See original GitHub issueNote: If your issue/bug is regarding the AWS Amplify Console service, please log it in the Amplify Console GitHub Issue Tracker
Describe the bug
When a table with a @connection
exists with this key already deployed:
type A @key(name: "ByBIdCId", fields: ["BId", "CId"], queryField: "AByBIdCId") {
B: String @connection
BId: String
C: String @connection
CId: String
}
And I try to deploy this
type A @key(name: "ByBIdCId", fields: ["BId", "CId"], queryField: "AByBIdCId")
@key(name: "ByBId", fields: ["BId"], queryField: "AByBId")
The CLI errors with Attempting to mutate more than 1 global secondary index at the same time
I can see in the /build/stacks/<table>.json
that the GSIs have generated correctly in the Cloudformation.
Amplify CLI Version 4.28.2
To Reproduce Steps to reproduce the behavior or terminal output if applicable
Expected behavior The key/index would deploy; using the console I can create the index OK.
Screenshots CF Stack (truncated):
"GlobalSecondaryIndexes": [
{
"IndexName": "ByB",
"KeySchema": [
{
"AttributeName": "BiD",
"KeyType": "HASH"
}
],
"Projection": {
"ProjectionType": "ALL"
},
"ProvisionedThroughput": {
}
},
{
"IndexName": "ByBC",
"KeySchema": [
{
"AttributeName": "BiD",
"KeyType": "HASH"
},
{
"AttributeName": "CiD",
"KeyType": "RANGE"
}
],
"Projection": {
"ProjectionType": "ALL"
},
"ProvisionedThroughput": {
}
},
{
"IndexName": "gsi-B",
"KeySchema": [
{
"AttributeName": "",
"KeyType": "HASH"
}
],
"Projection": {
"ProjectionType": "ALL"
},
"ProvisionedThroughput": {
}
},
{
"IndexName": "gsi-C",
"KeySchema": [
{
"AttributeName": "",
"KeyType": "HASH"
}
],
"Projection": {
"ProjectionType": "ALL"
},
"ProvisionedThroughput": {
}
},
{
"IndexName": "gsi-D",
"KeySchema": [
{
"AttributeName": "",
"KeyType": "HASH"
}
],
"Projection": {
"ProjectionType": "ALL"
},
"ProvisionedThroughput": {
}
}
]
Desktop (please complete the following information):
- OS: Windows 10
- Node Version. 12.13.1
I tried with 2 different tables and both yielded the same result, whether adding the Primary/Sort index key before or after the Primary index key.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
If you are creating the new
@key
between other existing@key
s this could be related to #5380 If that’s the case just add the key as the last one for given model instead of between and it should work.Closing as this issue has since been resolved. Upon checking out or creating an environment the files in
#current-cloud-backend
are updated to reflect the target environment.