Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Codedeploy fails in DownloadBundle event saying No such file or directory

I'm using AWS Codedeploy to deploy my code from GitHub to AWS EC2 instance(Windows 2008 server). Deployment fails in DownloadBundle event

Error stack in logs of AWS :

No such file or directory - C:\ProgramData/Amazon/CodeDeploy/4fbb84fd-caa5-4d1a-9894-16b25abcea76/d-QUPXMDBCF/deployment-archive-temp/My-Application-163e9d3343be82038fe2e5c58a9fcae86683d4ea/src/main/java/com/myapp/dewa/customexceptions/EventNotPublishedException.java

The problem here might be with the file path limit of windows.

UPDATE: AWS CodeDeploy Support team has confirmed that this is a limitation from their side. More than half of the file path is being used by CodeDeploy because of which limit is being exceeded

like image 307
balajiprasadb Avatar asked May 27 '16 10:05

balajiprasadb


People also ask

What should be checked first when an AWS CodeDeploy deployment fails?

Check your Amazon S3 bucket or GitHub repository to verify your application revision is in the expected location. Review the details of your CodeDeploy application revision to ensure that it is registered correctly. For information, see View application revision details with CodeDeploy.

How do I know if AWS CodeDeploy is running?

If the CodeDeploy agent is installed and running, you should see a message like The AWS CodeDeploy agent is running .

What is code deploy agent?

The CodeDeploy agent is a software package that, when installed and configured on an instance, makes it possible for that instance to be used in CodeDeploy deployments. Important. The minimum supported version of the CodeDeploy agent is 1.1. 0. Use of an earlier CodeDeploy agent might cause deployments to fail.

How do I uninstall CodeDeploy agent?

Uninstall the CodeDeploy agent from Windows Server You can also sign in to the instance, and in Control Panel, open Programs and Features, choose CodeDeploy Host Agent, and then choose Uninstall.


2 Answers

Have you replaced some strings from the file_path and/or file_name?

This error you get when the total length of the file_path is beyond 260 characters. This length includes one null character at the end for termination. Your total length is 239+1 = 240.

For reference, please see this article: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#maxpath

If you check the path in the destination, you should not see the file because it was not copied but it is in your revision zip file.

In my case, the total length was 266. It may not be possible to shorten the strings of the actual file path in the revision since lots of them are created by the developer tools. Amazon is investing at their end now to see how to overcome this.

You can test and confirm by doing the following:

  1. Run the following command in the command prompt to create the deployment archive folder: mkdir "c:\ProgramDat0/Amazon/CodeDeploy/4fbb84fd-caa5-4d1a-9894-16b25abcea76/d-QUPXMDBCF/deployment-archive-temp"

  2. Simply try to extract your revision zip file directly under 'deployment-archive-temp' folder. You should received the following error for file crossing the maximum path length of 260: 'Error 0x80010135: Path too long'

Ref: https://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx#maxpath

I hope this helps.

like image 177
Rafiq Avatar answered Oct 13 '22 14:10

Rafiq


While not a complete solution, I've experienced the same problem and we were able to remove the preceding 'ProgramData\Amazon\CodeDeploy' to save 29 characters if you can stand the mess in your root folder.

To do this we modified the conf.yml file located in c:\programdata\amazon\codedeploy\

I changed ... root_dir: 'Amazon\CodeDeploy' ... to ... root_dir: 'C:\'

like image 23
Neil Fahardoh Avatar answered Oct 13 '22 13:10

Neil Fahardoh