Sahan Amarsha
Sahan Amarsha

Reputation: 2546

Delete AWS Amplify Function - Resource cannot be removed because it has a dependency on another resource

I have added an S3 lambda trigger in my AWS Amplify project. However when I try to remove that lambda trigger using amplify remove function, it shows the following error.

Resource cannot be removed because it has a dependency on another resource
Dependency: S3 - s3xxxxxxxx
An error occurred when removing the resources from the local directory

AWS Amplify remove function error

AWS Amplify Documentation does not have a clear guide to remove lambda functions. So, how can I remove the function without removing the S3 resource?

Upvotes: 5

Views: 5283

Answers (1)

Sahan Amarsha
Sahan Amarsha

Reputation: 2546

  1. Since I created a trigger on the S3 resource, I need to remove that trigger first by running amplify update storage. Then choose the options that you configured previously. When Amplify CLI prompts to select an option, choose Remove the Trigger.

Running amplify update storage in CLI

  1. Then run amplify push to sync local changes with the cloud.

  2. Now, if we run amplify remove function again, and choose the S3 trigger function. It will execute without an error. Just remember to do another amplify push to sync and remove the function at last.

Upvotes: 7

Related Questions