Errors deploying node elastic beanstalk application - node.js

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:

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).

Related

Getting Execution failed for task ':buildJsApps' error when building Spartacus storefront code in the cloud

I have successfully created the spartacus store in my local using npm and angular cli. When I moved the same to our cloud, I am getting the below error while building the application:-
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':buildJsApps'.
Process 'command 'yarn'' finished with non-zero exit value 1
If it's similar to what we've experienced, it might be related to dependencies.
If the error says something about babel, it was raised here: https://spartacus-storefront.slack.com/archives/CD16V16FR/p1584744427389300 The fix was to change the version of the dependency:
...
"devDependencies": {
"#babel/compat-data": "7.8.0",
"#babel/preset-env": "7.8.0",
"babel-loader": "8.1.0",
...
},
...
"resolutions": {
"#babel/preset-env": "7.8.0"
}
If not, it could be related to the Angular version, where the latest 8.x causes the error, and the fix may be to downgrade:
"devDependencies": {
"#angular-devkit/build-angular": "0.803.25",
"#angular/cli": "8.3.25"

React-native App fails to launch in Android with multiple warning messages on debug builds

Environment
react-native-cli: 2.0.1, node : v8.2.1, npm: 5.3.0,
Target Platform:
Android 5.0 x86-64 image
Development Operating System:
Windows 7 professional edition, x86_64
package.json
"dependencies": {
"axios": "^0.16.2",
"buffer": "^5.0.6",
"lodash": "^4.17.4",
"mobx": "^3.2.1",
"mobx-react": "^4.2.2",
"react": "16.0.0-alpha.12",
"react-native": "0.45.1",
"react-native-background-timer": "^1.1.0",
"react-native-fetch-blob": "latest",
"react-native-timer": "^1.3.1"
},
"devDependencies": {
"babel-jest": "20.0.3",
"babel-preset-react-native": "2.0.0",
"jest": "20.0.4",
"react-test-renderer": "16.0.0-alpha.12",
"tslint": "^5.4.3",
"typescript": "^2.4.1",
"typings": "^2.1.1"
},
Steps to Reproduce
npm install, npm run build, react-native run-android
Expected Behavior
This is supposed to launch the application successfully on Physical device connected via USB or on the emulator running.
Actual Behavior
App fails to launch with these bunch of warning messages:
Warning: Failed prop type: Invalid prop 'alignItems' of value 'function checkType() {... [native code]
Warning: Failed prop type: Invalid prop 'bacckgroundColor' supplied to 'SrollView': function colorPropType() { [native code] }
Warning: Failed prop type: Invalid prop 'bacckgroundColor' supplied to 'View': function colorPropType() { [native code] }
Warning: Failed prop type: Invalid prop 'display' of type 'function' supplied to 'RCTView', expected 'string'. Bad object:{} in RCTView (at View.js:128)
....
Build and deployment works fine with release builds which means running the following command it works fine:
react-native run-android --variant=release
2) The same code base doesn’t work with apk debug builds
react-native run-android --variant=debug
3) The weird thing is that this behavior is not consistent. Intermittently sometimes it works fine. For example, I have tried using different combination of react/react-native versions in the package.json. Its observed that it worked once with react v0.47.1 and react-native v16.0.0-bet5. The same configuration on same set up failed later.
4) For once it also worked with a combination of both react/react-native upgraded to latest versions (v0.48_rc0 and v16.0.0-bet5 respectively). But that too is not consistently working.

jhipster:upgrade never completes

UPDATE:
I performed my upgrade using the manual steps and it worked fine.
Afterwards, I noticed that version 4.3.0 has a new --verbose flag, so I ran it again with the --force flag. It still hangs with no error at yarn run webpack:build.
I then ran yarn webpack:build by itself. It looked like it completed everything, but did not return control to the console. I noticed a yellow message box in my taskbar notification area, that says 'JHipster' Notification Image. When I click on that notification, the job completes and control returns to the console. (I have noticed this notification looks different on Win10 and I don't think it requires a click to dismiss.)
This notification does not appear when running jhipster:upgrade, so I am guessing that is what is hanging up the process.
(original post)
I have generated a jhipster project (4.1.1) and have been working with it. I tried to run jhipster:upgrade to 4.2.0 but the process never completes. (I left it overnight.)
I set up and repeated this process on another computer, and it runs fine.
I have tried to identify why/where the process is hanging on my main computer but have been unsuccessful.
Anyone have some steps, tips to identify what is going wrong?
My environment:
Win7 Enterprise
java version "1.8.0_74"
git version 2.12.0.windows.1
node v6.10.2
yarn 0.21.3
Command output:
C:\applications\jhipster\formsLib>yo jhipster:upgrade
Welcome to the JHipster Upgrade Sub-Generator
This will upgrade your current application codebase to the latest JHipster version
Looking for latest generator-jhipster version...
New generator-jhipster version found: 4.2.0
Git repository detected
Updating generator-jhipster to 4.2.0 . This might take some time...
Several node processes kick off and run for a while, but then they go idle.
I have tried uninstalling and reinstalling node and yarn.
I enabled NODE_DEBUG=cluster,net,http,fs,tls,module,timers node and reran it. The last few lines before it stalls are:
NET 15272: _read
NET 15272: onread 21
NET 15272: got data
NET 15272: _read
NET 15272: onread 33
NET 15272: got data
NET 15272: _read
NET 15272: onread 73
NET 15272: got data
NET 15272: _read
process 15272 is node "C:\Users\mbaxley\AppData\Local\Yarn\config\global\node_modules\.bin\\..\yo\lib\cli.js" jhipster:upgrade
View Remaining Node Tasks
The only file updated during the process is the package.json file. Here is the diff of the modified file:
diff --git a/package.json b/package.json
index 7a2a6b8..eb7de34 100644
--- a/package.json
+++ b/package.json
## -16,11 +16,11 ##
"#angular/platform-browser-dynamic": "2.4.9",
"#angular/router": "3.4.9",
"#ng-bootstrap/ng-bootstrap": "1.0.0-alpha.21",
+ "angular2-cookie": "1.2.6",
"angular2-infinite-scroll": "0.3.4",
"bootstrap": "4.0.0-alpha.6",
- "font-awesome": "4.7.0",
- "angular2-cookie": "1.2.6",
"core-js": "2.4.1",
+ "font-awesome": "4.7.0",
"jquery": "3.1.1",
"ng-jhipster": "0.1.9",
"ng2-webstorage": "1.5.1",
## -47,7 +47,7 ##
"exports-loader": "0.6.4",
"extract-text-webpack-plugin": "2.1.0",
"file-loader": "0.10.1",
- "generator-jhipster": "4.1.1",
+ "generator-jhipster": "4.2.0",
"html-loader": "0.4.5",
"html-webpack-plugin": "2.28.0",
"image-webpack-loader": "3.2.0",
## -65,9 +65,12 ##
"lazypipe": "1.0.1",
"lodash": "4.17.4",
"map-stream": "0.0.6",
+ "node-sass": "4.5.0",
"phantomjs-prebuilt": "2.1.14",
+ "postcss-loader": "1.3.0",
"proxy-middleware": "0.15.0",
"run-sequence": "1.2.2",
+ "sass-loader": "5.0.1",
"sourcemap-istanbul-instrumenter-loader": "0.2.0",
"string-replace-webpack-plugin": "0.1.3",
"style-loader": "0.14.0",
## -81,9 +84,6 ##
"webpack-visualizer-plugin": "0.1.11",
"write-file-webpack-plugin": "3.4.2",
"xml2js": "0.4.17",
- "sass-loader": "5.0.1",
- "node-sass": "4.5.0",
- "postcss-loader": "1.3.0",
"yargs": "6.6.0"
},
"engines": {

NPM install error: RangeError: Maximum call stack size exceeded

I am trying to install my npm dependencies on Ubuntu 14.04.3 (Linux ubuntu 3.13.0-45-generic #74-Ubuntu) from package.json file. I don't know if it is important, but Ubuntu is a virtual machine. I install dependencies in /tmp directory so it isn't any shared folder or samba resource.
Node.js version: 0.12.7.
Npm version: 3.3.9.
Package.json:
{
...
"devDependencies": {
"babel-loader": "5.3.*",
"bootstrap": "3.3.*",
"css-loader": "0.19.*",
"del": "2.0.*",
"extract-text-webpack-plugin": "0.8.*",
"file-loader": "0.8.*",
"gulp": "3.9.*",
"gulp-eslint": "1.0.*",
"gulp-util": "3.0.*",
"html-loader": "0.3.*",
"karma": "0.13.*",
"karma-chai-plugins": "0.6.*",
"karma-mocha": "0.2.*",
"karma-phantomjs-launcher": "0.2.*",
"karma-webpack": "1.7.*",
"mocha": "2.3.*",
"phantomjs": "1.9.*",
"style-loader": "0.12.*",
"url-loader": "0.5.*",
"webpack": "1.12.*",
"yargs": "3.27.*"
},
"engines": {
"node": ">= 0.12.0"
}
"dependencies": {
"express": "4.13.*"
}
}
I use --no-bin-links install flag (I need to copy node_modules directory to another NTFS based location).
When i am installing dependencies i have following error:
RangeError: Maximum call stack size exceeded
at emit (events.js:107:17)
at null.<anonymous>(/usr/lib/node_modules/npm/node_modules/npmlog/node_modules/are-we-there-yet/index.js:14:10)
at emit (events.js:107:17)
at null.<anonymous> (/usr/lib/node_modules/npm/node_modules/npmlog/node_modules/are-we-there-yet/index.js:14:10)
at emit (events.js:107:17)
at null.<anonymous> (/usr/lib/node_modules/npm/node_modules/npmlog/node_modules/are-we-there-yet/index.js:14:10)
at emit (events.js:107:17)
at null.<anonymous> (/usr/lib/node_modules/npm/node_modules/npmlog/node_modules/are-we-there-yet/index.js:14:10)
at emit (events.js:107:17)
at TrackerGroup.finish (/usr/lib/node_modules/npm/node_modules/npmlog/node_modules/are-we-there-yet/index.js:60:8)
Does anybody have any idea how to fix it?
You most probabbly experienced NPM Issues #9224 or #9239.
To work around the issues, you can install the packages into /tmp without the --no-bin-links flag and make sure that you replace the symlinks with files/dirs afterwards. You can use rsync -L to copy the files to NTFS with symlinks transformed into referent files and dirs.

Foreman start hangs

I'm trying to make an express (currently working) application to work with foreman start.
This is my Procfile:
web: node ./bin/www
This is my www file:
#!/usr/bin/env node
var debug = require('debug')('quiz');
var app = require('../app');
app.set('port', process.env.PORT || 3000);
var server = app.listen(app.get('port'), function() {
debug('Express server listening on port ' + server.address().port);
});
And this is my package.json:
{
"name": "quiz",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www"
},
"engines": {
"node": "0.10.x",
"npm": "1.4.x"
},
"devDependencies": {
"sqlite3": "^3.0.8"
},
"dependencies": {
"body-parser": "~1.8.1",
"cookie-parser": "~1.3.3",
"debug": "~2.0.0",
"ejs": "~0.8.5",
"express": "~4.9.0",
"express-partials": "^0.3.0",
"morgan": "~1.3.0",
"pg": "^4.1.1",
"pg-hstore": "^2.3.2",
"sequelize": "^1.7.0",
"serve-favicon": "~2.1.3"
}
}
When I run foreman start in the log everything looks alright:
23:17:21 web.1 | started with pid 1632
When I test it in my browser the request are shown in the log but nothing reach the browser.
This is de log when I try to browse to http://localhost:5000/:
23:20:56 web.1 | ←[0mGET / ←[32m200 ←[0m25.741 ms - 1404←[0m
23:20:56 web.1 | ←[0mGET /stylesheets/style.css ←[36m304 ←[0m5.098 ms - -←[0m
23:20:56 web.1 | ←[0mGET /stylesheets/wide.css ←[36m304 ←[0m4.419 ms - -←[0m
The request seems to be resolved but the browser keeps waiting for response indefinitely. Finally the browser shows ERR_EMPTY_RESPONSE.
I try to make some other arbitrary request with the same result:
23:23:08 web.1 | ←[0mGET /author ←[32m- ←[0m- ms - -←[0m
23:23:08 web.1 | ←[0mGET /stylesheets/smartphone.css ←[32m- ←[0m- ms - -←[0m
23:25:59 web.1 | ←[0mGET /author ←[32m- ←[0m- ms - -←[0m
23:28:00 web.1 | ←[0mGET /author ←[32m- ←[0m- ms - -←[0m
23:30:00 web.1 | ←[0mGET /author ←[32m- ←[0m- ms - -←[0m
Any idea of how could I debug this in order to figure what's happening?
Thanks in advance.
Heroku no longer supports foreman so the best approach would be to try using their recommended alternative to foreman instead: the heroku command "local".
The implementation is trivial:
Download and install the latest version of heroku toolbelt (which no longer includes foreman).
Instead of using foreman start use heroku local.
See heroku's web site for full details of heroku local.
Although you don't mention it, is it possible that the reason you are getting those ERR_EMPTY_RESPONSE messages is because foreman had died (rather than "hung") while handling the request? I had the same problem with some stylesheets after foreman had logged the message "sending SIGKILL to all processes" to the console, and terminated. Regardless, my problems vanished when I used heroku local instead of foreman start.
And even if heroku local also fails, that should become the issue to resolve rather than your current problem with foreman.

Resources