Operations FAQs
Deployment failure due to dangling resource
Scenario
Deployment of a change in a Depot environment has failed where a resource references another resource which appears to be missing
A deployment of a change to a Depot environment might fail with a message such as:
Error: Location ID aa980edc3bee not found - via dataset 431125afdf1c (feat-12345-component)
This error is stating that a Dataset cannot find a Location it references. The Dataset in this case is likely to be the change you are deploying, and the location is likely to be one which previously existed, but no longer does.
For shared Depot instances where git branches are used as branched environments within the Depot instance, this is a likely scenario if resources are shared across branches. As an example, branch A could have defined a Snowflake Location, and branch B could have defined a Dataset which uses the location defined in branch A. Someone might destroy or delete the resources in branch A, and when branch B is deployed the location it references no longer exists causing the above error.
Guidance
Be aware of the pitfalls in using shared resources across branches, as these can be ephemeral.
Use the Depot CLI's list-dangling-resources command to find any dangling resources in a Depot environment. Carefully scrutinise the output of the tool to ensure that resources listed are definitely able to be removed.
Documentation for running the list-dangling-resources CLI tool is available here.
Remove the dangling resource(s) by creating removing them from the Depot environment's master CodeCommit branch. E.g. a location would be found under locations/location-id.json. This could be removed by getting the HEAD commit id of master, and then running:
aws codecommit delete-file --repository-name sdp-environment-name-id12345 --branch-name master --parent-commit-id HEAD_COMMIT_ID_HERE --file-path "locations/location-id.json" --name "your name" --commit-message "remove orphaned item" --email "user@example.com" --profile aws-named-profile
Be sure to make a backup of the file before deleting it in case you commit a delete for a resource which is actually required (i.e. you might have mistakenly selected the wrong resource or one which was not actually dangling).