Reputation: 12718
When deploying my new elastic beanstalk, Node.js 12 running on 64bit Amazon Linux 2/5.2.2
, application, I'm getting error after running $ eb deploy myapp-staging-env
:
2020-10-17 19:57:56 INFO Environment update is starting.
2020-10-17 19:58:22 INFO Deploying new version to instance(s).
2020-10-17 19:58:49 ERROR Instance deployment failed. For details, see 'eb-engine.log'.
2020-10-17 19:58:49 ERROR [Instance: i-034b2f1000000] Command failed on instance. Return code: 1 Output: Engine execution has encountered an error..
2020-10-17 19:58:49 INFO Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
2020-10-17 19:58:49 ERROR Unsuccessful command execution on instance id(s) 'i-034b2f1d46f466259'. Aborting the operation.
2020-10-17 19:58:50 ERROR Failed to deploy application.
I don't really know where to start.
Errors from logs:
Web.stdout.log: where do I go to fix this error?
----------------------------------------
/var/log/web.stdout.log
----------------------------------------
Oct 17 17:31:43 ip-172-31-47-6 web: Server running at http://127.0.0.1:8080/
...
Oct 17 19:58:50 ip-172-31-47-6 web: /bin/sh: -c: line 0: syntax error near unexpected token `('
Oct 17 19:58:50 ip-172-31-47-6 web: /bin/sh: -c: line 0: `node app.js%!(EXTRA string=server.js)'
Engine execution has encountered an error: what does this mean?
2020/10/17 19:58:49.360716 [INFO] Executing cleanup logic
2020/10/17 19:58:49.360804 [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 failed. For details, see 'eb-engine.log'.","timestamp":1602964729,"severity":"ERROR"}]}]}
2020/10/17 19:58:49.360984 [INFO] Platform Engine finished execution on command: app-deploy
Execution error on command [app-deploy]
: where do I go to fix this?
2020/10/17 19:58:49.339070 [INFO] Running command /bin/sh -c systemctl start web.service
2020/10/17 19:58:49.360702 [ERROR] An error occurred during execution of command [app-deploy] - [FlipApplication]. Stop running the command. Error: Register application failed because the registration of proc web failed:
startProcess Failure: starting process "web" failed: Command /bin/sh -c systemctl start web.service failed with error exit status 1. Stderr:Job for web.service failed because the control process exited with error code. See "systemctl status web.service" and "journalctl -xe" for details.
My package.json:
{
"name": "api",
"version": "0.0.0",
"private": true,
"engines": {
"node" : "12.18.0"
},
"scripts": {
"initialize": "knex migrate:latest && knex seed:run",
"reset": "node_modules/.bin/knex migrate:rollback && node_modules/.bin/knex migrate:latest && node_modules/.bin/knex seed:run",
"initialize-prod": "node_modules/.bin/knex migrate:latest --env production && node_modules/.bin/knex seed:run --env production",
"reset-prod": "node_modules/.bin/knex migrate:rollback --env production && node_modules/.bin/knex migrate:latest --env production && node_modules/.bin/knex seed:run --env production",
"start": "node -v && node server.js",
"server": "node -v && nodemon server.js",
"server-debug": "nodemon --inspect=0.0.0.0 server.js",
"test": "mocha"
},
"dependencies": {
"@google-cloud/speech": "^3.5.4",
"@google-cloud/translate": "^5.1.4",
"body-parser": "^1.18.3",
"bookshelf": "^0.13.3",
"cookie-parser": "~1.4.3",
"cors": "^2.8.4",
"debug": "~2.6.9",
"dotenv": "^7.0.0",
"ejs": "~2.5.7",
"event-stream": "^3.3.5",
"express": "~4.16.0",
"fs": "0.0.1-security",
"fs-path": "0.0.24",
"knex": "^0.20.8",
"lodash": "^4.17.15",
"mailgun-js": "^0.22.0",
"moment": "^2.22.2",
"morgan": "^1.9.1",
"nock": "^10.0.6",
"node-gyp": "^7.1.2",
"passport": "^0.4.0",
"passport-cookie": "^1.0.6",
"pg": "^7.5.0",
"request": "^2.88.0",
"request-promise": "^4.2.2",
"swagger-jsdoc": "^4.0.0",
"swagger-ui-express": "^4.1.4"
},
"devDependencies": {
"chai": "^4.2.0",
"mocha": "^6.2.0",
"nodemon": "^1.18.4"
}
}
Also, for a previous node app I launched (last year), I was able to modify gzip compression
and specify the node command, but this option is no longer available:
Upvotes: 1
Views: 12224
Reputation: 12718
Elastic Beanstalk removed NodeCommand
from software config in favor of a Procfile
.
From updated AWS docs on EB Node Deployment:
You can add a Procfile to your source bundle to specify the command that starts your application, as the following example shows. This feature replaces the legacy NodeCommand option in the aws:elasticbeanstalk:container:nodejs namespace.
The Procfile
is added to the application root and contains your app run script, e.g.:
web: node server.js
I redeployed and it solved the deploy error (unsure about the Web.stdout.log
and app-deploy
errors above).
Upvotes: 6