Amplify CLI fails with Error: Cannot add S3Triggera54de6aa due to a cyclic dependency
See original GitHub issueDescribe the bug I am following the aws amplify photo albums tutorial but when building a new environment the S3 trigger fails with ‘access denied’ when calling S3.getObject().
Is there a separate step required to set permission for the S3 Trigger on the S3 bucket? Perhaps I missed it.
In any event then I tried to run ‘amplify function update’ to give the function access to the S3 bucket and I then get the following error:
Error: Cannot add S3Triggera54de6aa due to a cyclic dependency
at checkForCyclicDependencies (/usr/local/lib/node_modules/@aws-amplify/cli/lib/extensions/amplify-helpers/update-amplify-meta.js:188:15)
at AmplifyToolkit.updateamplifyMetaAfterResourceUpdate [as _updateamplifyMetaAfterResourceUpdate] (/usr/local/lib/node_modules/@aws-amplify/cli/lib/extensions/amplify-helpers/update-amplify-meta.js:114:9)
at updateFunctionResource (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-function/lib/provider-utils/awscloudformation/index.js:144:29)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Object.executeAmplifyCommand (/usr/local/lib/node_modules/@aws-amplify/cli/node_modules/amplify-category-function/lib/index.js:193:5)
at async executePluginModuleCommand (/usr/local/lib/node_modules/@aws-amplify/cli/lib/execution-manager.js:153:5)
at async Object.executeCommand (/usr/local/lib/node_modules/@aws-amplify/cli/lib/execution-manager.js:35:9)
at async Object.run (/usr/local/lib/node_modules/@aws-amplify/cli/lib/index.js:82:9)
Amplify CLI Version 4.29.5
To Reproduce N/A
Expected behavior I would expect the function to work
Screenshots N/A
Desktop (please complete the following information):
- OS: macOS
- Node Version. v12.18.1
Additional context N/A
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Delete an AWS Amplify application
Note: Deleting an Amplify application using the Amplify console or Amplify CLI can fail for many reasons. If you receive an error when ......
Read more >Amplify API GraphQL Circular Resources Dependency
we experience an issue of Circular dependency between resources: [Precaution, UserProfile, Obligation, CustomResourcesjson, Remembrance, Lookup, ...
Read more >@aws-amplify/cli - npm
Start using @aws-amplify/cli in your project by running `npm i ... Add a README to your package so that users know how to...
Read more >Amplify CLI - AWS Amplify Docs
Running the 'amplify add custom' command in your Amplify project provides CDK or CloudFormation starter files along with mechanisms to reference other Amplify- ......
Read more >AWS Amplify CLI Installation Guide (M1/M2 2022 Mac Edition)
Some examples of these great CLI commands include: amplify add auth : configure an AWS Cognito User Pool and methods for signing-in, including ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I just ran into this problem as well, so here is how I ran into it:
amplify add function
to create new function “S3Trigger”amplify update storage
and attempted to make “S3Trigger” the triggerThe issue appears to be that after creating the S3Trigger I added permission to the trigger to access API by using the ‘amplify function update’.
This created a policy with the same name as the S3Trigger’s bucket access policy which clobbered the bucket access policy.
Seems like a flaw in the amplify-cli logic that allows this to happen. Eventually I had to manually rename one of the policies as a workaround but you have to watch this each time you run the amplify-cli or it might get replaced if you subsequently run ‘amplify function update’ or ‘amplify storage update’