Skip to content

Error when trying to do a deployment on debian 10 #278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
btv opened this issue Feb 10, 2021 · 10 comments
Closed

Error when trying to do a deployment on debian 10 #278

btv opened this issue Feb 10, 2021 · 10 comments

Comments

@btv
Copy link

btv commented Feb 10, 2021

I'm trying to troubleshoot why my codedeployments aren't working. I'm using the latest version (1.3.1-1880) on debian 10. The install is fine and systemd's status command shows the service is up. However, when I try to do a local deployment using this command:
sudo bin/codedeploy-local -l s3://${VALID_PATH_TO_FILE}.zip -t zip

I end up getting this error:

/opt/codedeploy-agent/vendor/gems/logging-1.8.2/lib/logging/appender.rb:139: warning: constant ::Fixnum is deprecated
/opt/codedeploy-agent/vendor/gems/logging-1.8.2/lib/logging/logger.rb:295: warning: constant ::Fixnum is deprecated
Starting to execute deployment from within folder /opt/codedeploy-agent/deployment-root/default-local-deployment-group/d-FE8V8RVBJ-local
See the deployment log at /opt/codedeploy-agent/deployment-root/default-local-deployment-group/d-FE8V8RVBJ-local/logs/scripts.log for more details
Traceback (most recent call last):
	1: from bin/codedeploy-local:123:in `<main>'
bin/codedeploy-local:129:in `rescue in <main>': uninitialized constant InstanceMetadata::InstanceMetadataError (NameError)

Sadly, the log file is never written, so I can't get any deeper in troubleshooting this problem. Any help with this would be greatly appreciate. I'm also happy to perform any command you need to help with information gathering.

@renato-zannon
Copy link

renato-zannon commented Feb 16, 2021

I had a similar error when trying to use codedeploy-local for local experiments.

In my case, it was caused by this line, which was trying to rescue an exception class that is not even defined. I edited the code locally to remove the exception from the list (yay ruby), and was able to see the actual underlying error (a dumb mistake on my part).

What it looks like is that this InstanceMetadata module was either removed in a recent version of some dependency, or there is some require missing.

@btv
Copy link
Author

btv commented Feb 16, 2021

@renato-zannon , thanks for the hint. I'll look into more on the machine and see what I can find. I'm not proficient with Ruby, so its a little more of a challenge for me. I figured it was related to not having deployments work at all from the CodeDeploy console, maybe they are different? 🤷‍♂️

@btv
Copy link
Author

btv commented Feb 16, 2021

@renato-zannon Thank you again for the hint, I removed the module from the line and got this error:

/opt/codedeploy-agent/lib/instance_agent/plugins/codedeploy/installer.rb:124:in `generate_normal_copy': The deployment failed because a specified file already exists at this location: /${VALID_PATH_TO_VALID_FILE} (RuntimeError)

So it looks like the code "eats" the error message that a file that exists on the system can't be overwritten. I reran the same command with the -b OVERWRITE flag, and the local deployment works without issue.

Can you recommend any procedure to help debug a problem when codedeploy is initiated from the console? I specifically run my codedeploys to overwrite files that already exist, however, the code deployments never complete. So I'm not sure how to debug this process. Any help would be really appreciated.

@aekandem
Copy link

aekandem commented Mar 4, 2021

My issue as well.

@toshke
Copy link

toshke commented Apr 27, 2021

I had this issue as well. Interestingly enough, if binary is started with full path, issue is gone

bin/codedeploy-local:129:in `rescue in <main>': uninitialized constant InstanceMetadata::InstanceMetadataError (NameError)

however following works just fine

if /opt/codedeploy-agent/bin/codedeploy-local -l /opt/last_deployment.zip --type zip -b OVERWRITE; then
    echo "Local deployment successful"
    set -e
    return
  fi

@webkod3r
Copy link

Any updates on this? I recently installed the code-deploy agent and I'm getting the same issue

This is the Ruby version I have installed

ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux-gnu]

Thanks in advance for your help

@raghakrk
Copy link

I removed InstanceMetadata::InstanceMetadataError from this line, and it worked. Looks like this InstanceMetadata::InstanceMetadataError module was removed in a recent version.

@Eternal21
Copy link

Eternal21 commented Aug 30, 2022

I'm having the same issue on a Windows 2022 Server. I see people recommending removing some line, but codedeploy-local is a binary file on my server so I can't do it that way.

@t0shiii
Copy link
Contributor

t0shiii commented Mar 29, 2023

codedeploy-local error with InstanceMetadata::InstanceMetadataError has been fixed in the upcoming release of the agent version 1.6.0.

Agent source code will be available on GitHub this Friday, March 31st. Agent installer will be available in all commercial regions by April 7th.

@t0shiii t0shiii moved this from In Progress to Coming Soon in CodeDeploy Public Roadmap Mar 29, 2023
@mwjones-aws
Copy link
Contributor

CodeDeploy Agent 1.6.0 has been released to most commercial regions as of this comment.

Please track release progress on #360

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Coming Soon
Development

No branches or pull requests

9 participants