I’m working with existing amplify graphql api that is in production, the task I was given was to move the amplify to different aws account for development purposes. I’ve spent about 3 days to get things right but when I do update the schema for graphql I got an error on my cli stated
β An error occurred when pushing the resources to the cloud
π An error occurred during the push operation: ["Index: 1 State: {"deploy":"waitingForDeployment"} Message: Resource is not in the state stackUpdateComplete"]
looking more in cloud formation event log, it said
Circular dependency between resources: [BuildingAdminBuilding, BuildingAdmin, ConnectionStack, CustomResourcesjson]
the mentioned resources are defined as
type BuildingAdminBuilding @model(subscriptions: null) @aws_cognito_user_pools @auth(rules: [
{
provider: apiKey, allow: public, operations: [read, create, update, delete]
},
{
# TODO TEMP ONLY - FOR TESTING UNTIL PROPER GROUPS ARE SETUP
provider: userPools, allow: private, operations: [read, create, update, delete]
},
]) {
id: ID!
buildingAdmin: BuildingAdmin! @auth(rules: [
{
provider: apiKey, allow: public, operations: [read, create, update, delete]
},
{
# TODO TEMP ONLY - FOR TESTING UNTIL PROPER GROUPS ARE SETUP
provider: userPools, allow: private, operations: [read, create, update, delete]
},
]) @connection(name: "BuildingAdminBuilding")
# building: Building! @connection(name: "BuildingBuildingAdmin") @auth(rules: [
# {
# provider: apiKey, allow: public, operations: [read, create, update, delete]
# },
# {
# # TODO TEMP ONLY - FOR TESTING UNTIL PROPER GROUPS ARE SETUP
# provider: userPools, allow: private, operations: [read, create, update, delete]
# },
# ])
}
type BuildingAdmin
@model(subscriptions: null)
@aws_cognito_user_pools @auth(rules: [
{
provider: apiKey, allow: public, operations: [read, create, update, delete]
},
{
provider: userPools, allow: private, operations: [read, create, update, delete]
}
]) {
id: ID!
user: User @connection(name: "BuildingAdminUser")
buildings: [BuildingAdminBuilding] @auth(rules: [
{
provider: apiKey, allow: public, operations: [read, create, update, delete]
},
{
# TODO TEMP ONLY - FOR TESTING UNTIL PROPER GROUPS ARE SETUP
provider: userPools, allow: private, operations: [read, create, update, delete]
},
]) @connection(name: "BuildingAdminBuilding")
}
I’m not sure why it triggers circular dependency, at first I thought it was the attributes type but other model works ok. do you guys have any ideas?
2
Answers
It might not be a solution, but for me, redoing all the query is the solution and tries to push table one by one in a specific order to amplify. The order was to push type A, then push pivot table AB with only property that have connection to A, then push B, then update pivot AB with property that have connection to B.
I am experiencing the same issue. We have 3 x Amplify environments (DEV,TST and ACC).
the same code is deployed from DEV to TST to ACC.
we experience an issue of Circular dependency between resources: [Precaution, UserProfile, Obligation, CustomResourcesjson, Remembrance, Lookup, Contact] – only on the TST environment and ONLY when we deploy amplify via CICD.
When doing an amplify push, everything succeeds.
The resources in question in the Circular dependency are only API @models (tables).
When we remove table #1 (UserProfile) – then everything works.
When re-adding the table in the graphql.schema file – it fails again.
Thus – by removing and readding the tables in the schema file – does not make any difference.
There are no dependencies between the tables at all.
If anyone has experienced this behaviour and managed to resolve it without deleting amplify, your input would be welcomed.