aws / aws/aws-codedeploy-agent

codedeploy-agent gets stuck on the wrong deployment ID, incorrectly reports missing scripts

Open
#348 6 comments 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
337
Forks
195
Avg merge
10h 54m
Merged PRs (30d)
4

Description

CodeDeploy agent keeps trying to access an invalid application revision and fails to find scripts to run in application events. The original configuration where this occurred is a CodePipeline instance, but now when I create a deployment just for this application and deployment group, it keeps selecting the same bad deployment revision.

It's happening on Ubuntu 18.04. Not sure how to obtain `codedeploy-agent` version, as it doesn't implement `--version`. The closest I can see is in the logs:

Version file found in /opt/codedeploy-agent/.version with agent version OFFICIAL_1.4.1-2244_deb

The error I'm getting is this:

![aws-codedeploy-bad-script-ref](https://user-images.githubusercontent.com/7843659/222767599-904adfb2-3c2b-41e0-b953-3f65b811ac79.png)

Notice that the deployment ID following the deployment group ID is different from the actual deployment shown in details. This is the problem - that other deployment ID isn't even for this application, but another application that was deployed to the same VM at a different time.

Checking this deployment, it is properly picking up correct build artifacts, which do contain the script that it reports to be missing:

![aws-codedeploy-bad-script-ref-2](https://user-images.githubusercontent.com/7843659/222768457-d947fd99-ec6f-457b-a1e0-8879f98bbde2.png)

The revision location shown in details does contain the script that is reported as missing, so `codedeploy-agent` is definitely trying to refer to a bogus deployment ID when it is trying to locate the application revision.

Looking at the `codedeploy-agent` logs, it just reports this error that is visible in UI and no other useful information. In verbose mode, it references the correct application revision and, on the next log line after this, is trying to open `appspec.yml` for the bogus deployment ID reported in the error.

I also noticed that deployment ID referenced in revision details in the screenshot above is different for manually-created deployments in that it may be different from the current deployment ID in the same screenshot and seems to be referring to the deployment ID that was active at the time CodePipeline was running, when it got a notification from the CodeBuild stage. Mentioning this because it sounds plausible that this is where the original deployment ID mix-up happened.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.