Not able to delete a custom resource
How did you install the Amplify CLI?
npm install -g @aws-amplify/cli
If applicable, what version of Node.js are you using?
14.19.3
Amplify CLI Version
10.5.2
What operating system are you using?
Windows
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
No
Describe the bug
Hello,
In my Project i have two Custom Resources.
- PSBuildSearchIndex
- PSBuildOpenSearch
Each Custom Resource creates a Step Function. One Step Function (PSBuildSearchIndex) is called by the other one (PSBuildOpenSearch).
So there is a dependency in the backend-config.json

But now, i want to delete the second StepFunction (PSBuildOpenSearch). I already adjusted my cdk-stack for the first StepFunction in a way, that the second is no longer needed.
But i'm not able to delete the second StepFunction via the amplify command: "amplify custom remove"

i can't remove the dependency via the amplify command "amplify custom update" because it just gives me the possibility to edit the stack-files for custom resources.
i already tried to remove the dependency directly in the backend-config.json. but the error still exits. => i assume that the amplify cli considers the backend-config.json from the "#current-cloud-backend" folder?! I'm not sure if it's a good idea to edit files from the "#current-cloud-backend" folder
if i remove the dependency from the backend-config.json in the amplify folder, and do an "amplify push", then amplify restores the dependency.
Can someone help me to delete the dependency/custom resource?
Kind Regards Stefan
Expected behavior
Deletion of the custom resource should be possible
Reproduction steps
edit backend-config.json (remove the dependency) amplify custom remove => Error
Project Identifier
Project Identifier: fb73b5648b874fc6d944e3d311bcaaa0 report-1672786058380.zip
Log output
# Put your logs below this line
Additional information
No response
Before submitting, please confirm:
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- [X] I have removed any sensitive information from my code snippets and submission.
Hey @StefanVolkmer-WW :wave: thanks for raising this! After removing the dependency from backend-config.json it is possible this dependency still exists in amplify/backend/amplify-meta.json. Can you try running amplify env checkout <current-env-name> after manually removing the dependency in backend-config.json to see if this alleviates the issue on push?
Hi @josefaidt : Thanks for your response. i already tried an env checkout after deleting the dependency. but with the env checkout the dependency was added again.
But 2 Minutes ago, I found the Reason.
In the first StepFunction had a AmplifyHelpers.addResourceDependency
This leads that the dependency is added everytime to the backend-config.json when you do an amplify push or an amplify env checkout.
i removed the coding, then i was able to delete the dependency in the backend-config.json, and do afterwards an env checkout, which doesn't add the dependency again.