EB throwing nodejs version error during deployment - amazon-web-services

I'm trying to deploy a nodejs app on elastic beanstalk. I create the environment with nodejs 10, matching the nodejs version in my package.json. The deployment fails, and the logs show
An error occurred during execution of command [app-deploy] - [Install customer specified node.js version]. Stop running the command. Error: unsupported node version v10.23.1, please specify any of node versions in [v10.0.0 v10.1.0 v10.10.0 v10.11.0 v10.12.0 v10.13.0 v10.14.0 v10.14.1 v10.14.2 v10.15.0 v10.15.1 v10.15.2 v10.15.3 v10.16.0 v10.16.1 v10.16.2 v10.16.3 v10.17.0 v10.18.0 v10.18.1 v10.19.0 v10.2.0 v10.2.1 v10.20.0 v10.20.1 v10.21.0 v10.22.0 v10.22.1 v10.23.0 v10.23.1 v10.23.2 v10.23.3 v10.24.0 v10.3.0 v10.4.0 v10.4.1 v10.5.0 v10.6.0 v10.7.0 v10.8.0 v10.9.0]
My package.json include:
"engines": {
"node": "v10.23.1", # I've tried 10.23.1, ^10.23.1, etc
"npm": ">=6.14.10"
}
This error appears to be non-sensical - am I missing something about EB?

Related

Elastic Beanstalk with Docker running on 64bit Amazon Linux 2/3.2.2 and Dockerrun.aws.json v3

Could somebody please point me to the correct Dockerrun.aws.json v3 documentation.
I have done google many times and unable to find this v3 documentation.
I am trying to do multi-container deployment to elastic beanstalk with
Docker running on 64bit Amazon Linux 2/3.2.2 but unsuccessful so far.
So far I am using Dockerrun.aws.json v2 format which seems to not work with this docker platform.
{
"AWSEBDockerrunVersion": 2,
"containerDefinitions": [
{
"name": "simple-ui",
"image": "my-image-located-in-ECR",
"essential": true,
"memory": 128,
"portMappings": [
{
"hostPort": 80,
"containerPort": 3000
}
],
"command": ["npm","start"]
}
]
}
Below is the error I am seeing in EB logs:
2020/12/09 18:55:34.954345 [ERROR] An error occurred during execution
of command [app-deploy] - [Docker Specific Build Application]. Stop
running the command. Error: parse Dockerrun.aws.json file failed with
error json: invalid use of ,string struct tag, trying to unmarshal
unquoted value into int
2020/12/09 18:55:34.954356 [INFO] Executing cleanup logic 2020/12/09
18:55:34.954437 [INFO] CommandService Response:
{"status":"FAILURE","api_version":"1.0","results":[{"status":"FAILURE","msg":"Engine
execution has encountered an
error.","returncode":1,"events":[{"msg":"Instance deployment:
'Dockerrun.aws.json' in your source bundle specifies an unsupported
version. Elastic Beanstalk only supports version 1 for non compose app
and version 3 for compose app. The deployment
failed.","timestamp":1607540134,"severity":"ERROR"},{"msg":"Instance
deployment failed. For details, see
'eb-engine.log'.","timestamp":1607540134,"severity":"ERROR"}]}]}
Thank you for your help in advance.
Rabin
Docker running on 64bit Amazon Linux 2/3.2.2
You are using Docker running on 64bit Amazon Linux 2/3.2.2 which, as the error write, is used only for Dockerrun.aws.json v1.
To use v2, you have to use EB platform:
Multi-container Docker running on 64bit Amazon Linux
The multi-container docker platform is deprecated and missing a lot of features that you'll find in the plain jane Docker platform on EB. However the docs are extremely confusing as you noticed above. Check out this stack overflow post for more details.
How to use multi container docker in Elastic beanstalk using Amazon linux 2?
With 64bit Amazon Linux 2 for multi container setups it's very important to make sure the elasticbeanstalk buildspec.yml has these two file artifacts
artifacts:
files:
- 'Dockerrun.aws.json'
- 'docker-compose.yml'`
You can verify that the file is within the source by going to:
Elastic Beanstalk > Applications > { application name } > Application versions
and then clicking on the source of the latest application to download the folder.
I was only sending the Dockerrun.aws.json to EBS and then thus wondering why I got the same v1 v3 error you got. In hindsight this make a lot of sense that the docker-compose.yml is needed.
I had exactly the same worries.
I changed the value of "AWSEBDockerrunVersion" in "Dockerrun.aws.json" of version 1 to "3" and then deployed it.
Then, strangely, the following message was displayed.
Instance deployment: 'Dockerrun.aws.json' in your source bundle
specifies an unsupported version. Elastic Beanstalk only supports
version 1 for non compose app and version 3 for compose app. The
deployment failed.
This means that you can just use version 1 of json for Amazon Linux 2 AMIs.

why eb deploy failed on first deploy?

I have created 2 NodeJs environments. It works fine.
Later created a new environment and eb deploy env_name give me the following error:
Creating application version archive "app-ceb7-200713_223016".
Uploading appname/app-ceb7-xxxxx.zip to S3. This may take a while.
Upload Complete.
2020-07-13 17:00:23 INFO Environment update is starting.
2020-07-13 17:00:44 INFO Deploying new version to instance(s).
2020-07-13 17:00:50 ERROR [Instance: i-066f599db7ee34] Command failed on instance.
An unexpected error has occurred [ErrorCode: 0000000001].
2020-07-13 17:00:50 INFO Command execution completed on all instances. Summary:
[Successful: 0, Failed: 1].
2020-07-13 17:00:50 ERROR Unsuccessful command execution on instance id(s) 'i-
06682f599db76ee34'. Aborting the operation.
2020-07-13 17:00:50 ERROR Failed to deploy application.
ERROR: ServiceError - Failed to deploy application.
Why this happen? Thanks in advance
Based on the comments.
To solve the issue, EB logs were inspected to identify the error message:
[app-deploy] - [Install customer specified node.js version]. Stop running the command. Error: unsupported node version >=6, please specify any of node versions in [v12.0.0 v12.1.0 v12.10.0 v12.11.0 v12.11.1 v12.12.0 v12.13.0 v12.13.1 v12.14.0 v12.14.1 v12.15.0 v12.16.0 v12.16.1 v12.16.2 v12.16.3 v12.17.0 v12.18.0 v12.18.1 v12.2.0 v12.3.0 v12.3.1 v12.4.0 v12.5.0 v12.6.0 v12.7.0 v12.8.0 v12.8.1 v12.9.0 v12.9.1]
Then, the correct version of the nodejs was specified in package.json:
"engines": { "node": "12.13.0"},

Unknown or duplicate parameter: NodeCommand

I'm trying to deploy a Node.js API with Elastic beanstalk.
I want to set the node command to start the app.
This is my nodecommand.config:
option_settings:
aws:elasticbeanstalk:container:nodejs:
NodeCommand: "npm start"
This is my file structure:
Whenever I try to run eb deploy, I get this error:
2020-05-13 19:03:44 INFO Environment update is starting.
2020-05-13 19:03:48 ERROR "option_settings" in one of the configuration files failed validation. More details to follow.
2020-05-13 19:03:48 ERROR Unknown or duplicate parameter: NodeCommand
2020-05-13 19:03:48 ERROR Failed to deploy application.
ERROR: ServiceError - Failed to deploy application.
I just encountered this very same issue. Upon investigation I found that "NodeCommand" is the legacy way to run your application with custom commands.
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_nodejs.container.html
I removed the ".ebextensions" directory and added a file called "Procfile" to my source directory.
Inside Procfile, try putting the following:
web: npm start
Make sure you update your repository with these changes if necessary before trying to deploy.
Hope this helps!
I used Procfile to deploy app
in Procfile
web: npm run deploy
In package.json, added new command deploy
"scripts": {
"deploy": "npm run build && npm run start"
},
For those who came here through Google, I had a similar problem and was getting this response:
ERROR: ServiceError - Configuration validation exception: Unknown or duplicate parameter: NodeVersion
After trying a lot of things I learned this is now legacy. I deleted that file and added a ProcFile at the root of my application (file name is case sensitive, there doesn't seem to be a required extension), with this line:
web: npm start
That error disappeared (to be replaced by a different one about role permissions, but any progress is good progress, right?).

eb deploy always fails

I have created a ruby env on amazon elastic beanstalk, but when I try to deploy my rails app from command line using eb deploy I get this error:
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
installing your bundle as root will break this application for all non-root
users on this machine.
You need to install git to be able to use gems from git repositories. For help
installing git, please refer to GitHub's tutorial at
https://help.github.com/articles/set-up-git (Executor::NonZeroExitStatus)
[2015-08-09T15:50:38.513Z] INFO [4217] - [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook/10_bundle_install.sh] : Activity failed.
[2015-08-09T15:50:38.513Z] INFO [4217] - [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook] : Activity failed.
[2015-08-09T15:50:38.513Z] INFO [4217] - [CMD-AppDeploy/AppDeployStage0] : Activity failed.
[2015-08-09T15:50:38.514Z] INFO [4217] - [CMD-AppDeploy] : Completed activity. Result:
Command CMD-AppDeploy failed.
So, shall I install git at amazon instance bash directly? will this effect autoscaling?
I don't know if you fixed this, but you need to tell Elastic Beanstalk to install git.
In the root directory of your project, add a folder called .ebextensions.
Create a file inside that folder called (something like) install_git.config (the .config is important).
Add the following lines to that file:
packages:
yum:
git: []
Then redeploy your application, and you shouldn't see that error anymore.

AWS Elastic Beanstalk - ERROR: No Application Version named 'v0_9_2-76-gf5a4' found

I'm trying to deploy my code to AWS Beanstalk and get this error. I researched that it could be that the number of versions is more than 500, so I deleted a lot of versions. But, I still get this error.
eb deploy
ERROR: No Application Version named 'v0_9_2-76-gf5a4' found.
I also tried
git aws.push
Error: Failed to create the AWS Elastic Beanstalk application version
Edit:
Trying with eb deploy --debug I now get:
Instance: i-2ad238d5 Module: AWSEBAutoScalingGroup ConfigSet: null Command failed on instance. Return code: 1 Output: Error occurred during build: Command hooks failed . Script /opt/elasticbeanstalk/hooks/appdeploy/pre/10_bundle_install.sh failed with returncode 18
ebcli.objects.exceptions.ServiceError: Update environment operation is
complete, but with errors. For more information, see troubleshooting
documentation.
Did you update the file .elasticbeanstalk/config.yml ? It may have a wrong setup.
Make a backup of .elasticbeanstalk/ folder and remove it
Execute eb create
Select the same region you deployed it before. You can check the region on .elasticbeanstalk/config.yml backup
A list with the environments will appear, select the right one
Deploy now
Remove the .elasticbeanstalk/config.yml backup
Check for the .elasticbeanstalk/config.yml file
environment: CORRECT_ENV_NAME
global:
application_name: CORRECT_APP_NAME
In my case, I was doing eb deploy X where X was an environment for a different project.
When I had the error
InvalidParameterValueError: No Application Version named 'app-9f5c-180927_071528' found.
I fixed this by specifying the label I wanted to push up.
eb deploy XXX-env -l XXX.0.0.1
The -l flag is documented AWS EB Deploy Docs
most likely, the deploy is trying an incorrect Elasticbeanstalk Application. it could be because you renamed the application in the AWS console.
so double check you're pointing to the correct elasticbeanstalk Environment and Application. it could be picking out default values from your .elasticbeanstalk/config.yml file.