How did you install the Amplify CLI?
Local
If applicable, what version of Node.js are you using?
No response
Amplify CLI Version
Local
What operating system are you using?
Mac
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
No
Describe the bug
Running npx amplify gen2-migration generate can result in a Gen2 app that cannot be deployed due to circular dependencies issues:
🛑 [CloudformationStackCircularDependencyError] circular dependency found between nested stacks [storage, auth, data, function]
Expected behavior
Resources should be placed in the correct stacks such that circular dependencies don't exist.
Reproduction steps
Fitness tracker suffers from this. We currently compensate by instructing the user to change the resourceGroupName property of the function.
Project Identifier
No response
Log output
Details
# Put your logs below this line
Additional information
In addition, when a function accesses multiple resources, the access property on defineAuth creates a dependency auth -> function. If that function also accesses another category, say data, we now have an auth -> data dependency which creates a circle. Same thing happens with storage. So resourceGroupName alone doesn't fix the problem.
If however direct function.addToRolePolicy CDK is used, this dependency is avoided because it preserves the function -> auth direction, not the reverse.
Before submitting, please confirm:
How did you install the Amplify CLI?
Local
If applicable, what version of Node.js are you using?
No response
Amplify CLI Version
Local
What operating system are you using?
Mac
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
No
Describe the bug
Running
npx amplify gen2-migration generatecan result in a Gen2 app that cannot be deployed due to circular dependencies issues:🛑 [CloudformationStackCircularDependencyError] circular dependency found between nested stacks [storage, auth, data, function]Expected behavior
Resources should be placed in the correct stacks such that circular dependencies don't exist.
Reproduction steps
Fitness tracker suffers from this. We currently compensate by instructing the user to change the
resourceGroupNameproperty of the function.Project Identifier
No response
Log output
Details
Additional information
In addition, when a function accesses multiple resources, the
accessproperty ondefineAuthcreates a dependencyauth->function. If that function also accesses another category, saydata, we now have anauth->datadependency which creates a circle. Same thing happens with storage. SoresourceGroupNamealone doesn't fix the problem.If however direct
function.addToRolePolicyCDK is used, this dependency is avoided because it preserves thefunction->authdirection, not the reverse.Before submitting, please confirm: