Skip to content

Commit 0493224

Browse files
committed
Add custom stack example
1 parent 0174d70 commit 0493224

File tree

1 file changed

+10
-1
lines changed
  • src/pages/[platform]/build-a-backend/troubleshooting/circular-dependency

1 file changed

+10
-1
lines changed

src/pages/[platform]/build-a-backend/troubleshooting/circular-dependency/index.mdx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,18 @@ export const preSignUpTrigger = defineFunction({
4848
resourceGroupName: 'auth',
4949
});
5050
```
51-
5251
If you are unable to resolve this error using function's `resourceGroupName` property, please create an issue [here](https://github.com/aws-amplify/amplify-backend/issues/new/choose)
5352

53+
### Circular dependency error with with a custom stack
54+
55+
If you are creating cdk resources and assigning them to a CustomStack, you might also run into this issue. Your error message would look like "The CloudFormation deployment failed due to circular dependency found between nested stacks [storage1234ABCD, auth5678XYZ, **MYCustomStack0123AB**]
56+
57+
To resolve this, try creating your resources in the same stack as the resources you are trying to interact with. For example, if a custom resource such as `sqs` needs to interact with the s3 resource created by `defineStorage`, you can create that `sqs` resource in the stack created by Amplify. You can reference the existing Amplify created stack like
58+
59+
```ts title="backend.ts"
60+
const queue = new sqs.Queue(backend.storage.stack, 'MyCustomQueue');
61+
```
62+
5463
## Circular dependency error between resources in the same stack
5564

5665
If you see this error "The CloudFormation deployment failed due to circular dependency found between resources [resource1, resource2] in a single stack", that means the resources themselves have a circular dependency in the same stack. For handling such errors, see https://aws.amazon.com/blogs/infrastructure-and-automation/handling-circular-dependency-errors-in-aws-cloudformation/

0 commit comments

Comments
 (0)