Heroku - crash all the time - heroku

I am developing node.js app on heroku. For now it runs on single (free) dyno.
For some reason suddenly my app crashed and now it crashes all the time (I observed it after adding NewRelic and Librato addons - app is kind of restarted when adding those addons) - app crashed for the first time after one of those addons were added. So I removed both addons but problem still remained. I wanted to check whats wrong and I commented my app code and replaced it with simple example from the web:
index.js
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(process.env.PORT);
console.log('Server running at http://127.0.0.1:1337/');
Procfile
web: node index.js
engines in packages.json (node installed by heroku is 0.10.26)
"engines": {
"node": "0.10.x"
},
This code works on my pc (tested with foreman).
When I try to deploy it to heroku app crashes - here is the log:
2014-04-25T09:43:42+00:00 heroku[slug-compiler]: Slug compilation started
2014-04-25T09:43:47.850609+00:00 heroku[api]: Release v30 created by xxx
2014-04-25T09:43:47.850538+00:00 heroku[api]: Deploy 562babb by xxx
2014-04-25T09:43:47+00:00 heroku[slug-compiler]: Slug compilation finished
2014-04-25T09:43:48.588089+00:00 heroku[web.1]: State changed from crashed to starting
2014-04-25T09:43:55.655057+00:00 heroku[web.1]: Starting process with command `node index.js`
2014-04-25T09:43:57.931274+00:00 heroku[web.1]: Process exited with status 8
2014-04-25T09:43:57.945393+00:00 heroku[web.1]: State changed from starting to crashed
when I try to heroku restart:
2014-04-25T09:44:43.071357+00:00 heroku[web.1]: State changed from crashed to starting
2014-04-25T09:44:51.834860+00:00 heroku[web.1]: Starting process with command `node index.js`
2014-04-25T09:44:54.250631+00:00 heroku[web.1]: State changed from starting to crashed
2014-04-25T09:44:54.235545+00:00 heroku[web.1]: Process exited with status 8
This make me crazy - I deployed many node apps to heroku which are runing in production and had never such problems - whats going on???
When I changed node engine version to 0.10.20 (I am using this v localy) then app started and was working but when I did heroku restart it crashed again...
State changed from up to starting
2014-04-25T10:10:12.990317+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2014-04-25T10:10:15.145758+00:00 heroku[web.1]: Process exited with status 143
2014-04-25T10:10:16.151380+00:00 heroku[web.1]: Starting process with command `node index.js`
2014-04-25T10:10:18.905637+00:00 heroku[web.1]: Process exited with status 8
2014-04-25T10:10:18.929730+00:00 heroku[web.1]: State changed from starting to crashed
after second restart app was up and runing again, and after third restart it crashed again (it always crashes/exits with status 8).

The problem could be on Heroku itself. There was an incident report created about an hour ago but it is still unclear what is causing the problem:
https://status.heroku.com/incidents/614
Meanwhile, you might want to rollback to the previous working build of your app via HerokuDashboard.

add this config to package.json:
"scripts": {
"start": "node index.js"},
index.js is name of of file you want to start you app from here like www.js or server.js
www.piero.ir/en

Related

State Changed from up to Crashed ( Discord App Won't Start ) , and yes i use a start script and everything is right

2022-05-27T00:41:10.751190+00:00 heroku[worker.1]: State changed from up to crashed
2022-05-27T00:41:10.761682+00:00 heroku[worker.1]: State changed from crashed to starting
2022-05-27T00:41:12.597341+00:00 heroku[worker.1]: Starting process with command : node .
2022-05-27T00:41:13.215607+00:00 heroku[worker.1]: State changed from starting to up
2022-05-27T00:41:13.579455+00:00 heroku[worker.1]: Process exited with status 0
2022-05-27T00:41:13.649880+00:00 heroku[worker.1]: State changed from up to crashed
2022-05-27T00:41:45.366307+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2022-05-27T00:41:45.457887+00:00 heroku[web.1]: Stopping process with SIGKILL
2022-05-27T00:41:45.474285+00:00 app[web.1]: Error waiting for process to terminate: No child processes
2022-05-27T00:41:45.610972+00:00 heroku[web.1]: Process exited with status 22
For python,
Simply, use gunicorn to easen the burden.
Within the project directory, with the virtual environment activated, install gunicorn as follows:
pip install gunicorn
If you're using pipenv you can try:
pipenv install gunicorn
Update the requirements.txt file to include the new installed gunicorn module by running:
pip freeze > requirements.txt
Update the Procfile as follows:
web: gunicorn your_django_project_name.wsgi --log-file -
N.B:
There should be space between the web: and gunicorn as well as between --log-file and the - next to it.
Lastly, add, commit and push the changes
For js devs,
Make sure the Procfile looks like:
web: npm start
THEN
try this solution here

Golang -- Deploy app using heroku app crashed H10

I need help...
I'm using heroku to deploy my golang app... but it seems my Procfile is not in the right format... here is the Procfile:
web: app-crm
everytime I deploy the app, it says succeeded but then after I access my endpoint, my app crashed with this message:
2021-11-15T08:00:49.813561+00:00 heroku[web.1]: State changed from crashed to starting
2021-11-15T08:00:50.113738+00:00 heroku[web.1]: Starting process with command `app-crm`
2021-11-15T08:00:51.791188+00:00 app[web.1]: bash: app-crm: command not found
2021-11-15T08:00:51.920794+00:00 heroku[web.1]: Process exited with status 127
2021-11-15T08:00:51.998349+00:00 heroku[web.1]: State changed from starting to crashed
2021-11-15T08:00:52.006946+00:00 heroku[web.1]: State changed from crashed to starting
2021-11-15T08:00:52.312734+00:00 heroku[web.1]: Starting process with command `app-crm`
2021-11-15T08:00:53.169065+00:00 app[web.1]: bash: app-crm: command not found
2021-11-15T08:00:53.278936+00:00 heroku[web.1]: Process exited with status 127
2021-11-15T08:00:53.342179+00:00 heroku[web.1]: State changed from starting to crashed
I tried to change how to access the port several times too, but it still doesn't work...
is there anyway I could fix it?

How to run a node app with no listening port in Heroku

I have a node app that does a simple web scraping in real time.
Since it has no back-end feature, it doesn't listen any port and never use Express.
When I deploy this app, Heroku automatically runs some commands to build and run my app.
This is my package.json file.
"scripts": {
"develop": "nodemon --exec babel-node src",
"test": "mocha --require babel-core/register",
"build": "rimraf lib && babel src -d lib",
"start": "node lib",
"lint": "eslint src"
}
I checked the Heroku logs to see if the app is running properly but I found errors like below.
...
2020-12-27T07:24:48.000000+00:00 app[api]: Build succeeded
2020-12-27T07:25:46.564866+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2020-12-27T07:25:46.589773+00:00 heroku[web.1]: Stopping process with SIGKILL
2020-12-27T07:25:46.680704+00:00 heroku[web.1]: Process exited with status 137
2020-12-27T07:25:46.732427+00:00 heroku[web.1]: State changed from starting to crashed
2020-12-27T07:25:46.735872+00:00 heroku[web.1]: State changed from crashed to starting
2020-12-27T07:25:51.844095+00:00 heroku[web.1]: Starting process with command `npm start`
2020-12-27T07:25:54.728760+00:00 app[web.1]:
2020-12-27T07:25:54.728776+00:00 app[web.1]: > my-node-app#0.1.0 start /app
2020-12-27T07:25:54.728777+00:00 app[web.1]: > node lib
2020-12-27T07:25:54.728777+00:00 app[web.1]:
2020-12-27T07:26:52.296540+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2020-12-27T07:26:52.315003+00:00 heroku[web.1]: Stopping process with SIGKILL
2020-12-27T07:26:52.410290+00:00 heroku[web.1]: Process exited with status 137
2020-12-27T07:26:52.468187+00:00 heroku[web.1]: State changed from starting to crashed
It seems building was successful but has failed when running it.
In my opinion, Heroku tried to bind PORT but my app never listened any port, so these errors had occurred.
How can I run my app successfully with no error on Heroku in this case?
If your node.js project is a web server, you cannot remove the port. No port, no web server. Trying to make a web server without a port is like trying to make a locomotive with no railroad.
You can use the default port however. When users give browsers URLs without ports, they automatically apply the default port.
Heroku also provide the default port so you don't have to specify the port
Just deploy your app and use the url provided by the heroku to call node js application

Nuxt App deployed to Heroku doesn't find sass-loader

I'm trying to deploy a Nuxt SPA app to Heroku.
Locally everything works fine, but when I deploy to Heroku it gives me an application error with the info to check my heroku logs:
2019-10-11T02:49:50.897584+00:00 heroku[web.1]: State changed from crashed to starting
2019-10-11T02:49:54.670233+00:00 heroku[web.1]: Starting process with command `npm start`
2019-10-11T02:49:56.590749+00:00 app[web.1]:
2019-10-11T02:49:56.590769+00:00 app[web.1]: > sol37.web#1.0.0 start /app
2019-10-11T02:49:56.59077+00:00 app[web.1]: > nuxt start
2019-10-11T02:49:56.590772+00:00 app[web.1]:
2019-10-11T02:49:57.167804+00:00 app[web.1]: ℹ Listening on: http://localhost:49791/ 2019-10-11T02:50:02.00478+00:00 heroku[web.1]: source=web.1 dyno=heroku.149207054.9b940788-6a37-40a9-82de-b19b3519e60c sample#memory_total=55.14MB sample#memory_rss=55.14MB sample#memory_cache=0.00MB sample#memory_swap=0.00MB sample#memory_pgpgin=14487pages sample#memory_pgpgout=1392pages sample#memory_quota=512.00MB
2019-10-11T02:50:23.81059+00:00 heroku[web.1]: source=web.1 dyno=heroku.149207054.9b940788-6a37-40a9-82de-b19b3519e60c sample#memory_total=55.14MB sample#memory_rss=55.14MB sample#memory_cache=0.00MB sample#memory_swap=0.00MB sample#memory_pgpgin=14487pages sample#memory_pgpgout=1392pages sample#memory_quota=512.00MB
2019-10-11T02:50:45.744385+00:00 heroku[web.1]: source=web.1 dyno=heroku.149207054.9b940788-6a37-40a9-82de-b19b3519e60c sample#load_avg_1m=0.00
2019-10-11T02:50:45.762243+00:00 heroku[web.1]: source=web.1 dyno=heroku.149207054.9b940788-6a37-40a9-82de-b19b3519e60c sample#memory_total=55.14MB sample#memory_rss=55.14MB sample#memory_cache=0.00MB sample#memory_swap=0.00MB sample#memory_pgpgin=14487pages sample#memory_pgpgout=1392pages sample#memory_quota=512.00MB
2019-10-11T02:50:54.906637+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
I checked if I set the port somewhere manually, but I'm not doing that anywhere in the project.
Without more information, i tried to build the app on heroku directly.
("heroku run bash" and "npm run build") which gave me the following error.
ERROR in ./pages/index.vue
Module not found: Error: Can't resolve 'sass-loader' in '/app'
and 7 more of those errors all concerning sass-loader.
not sure if "npm run build" works over heroku bash, but at least it gave me some information.
I have another nuxt project that i run on the same heroku instance which works without a problem.
I tried to check what the differences are and i found that it used a lower sass-loader version, which i downgraded on my current project but it's still not working.
After that I tried to run "npm run start" which is what Heroku runs upon deployment. this gave me first an error with nuxtjs/style-ressource, which i realized i don't utilize right now, so i removed that. After that it ran without any issues, but i couldn't get it to show up in the browser.
Does anyone have any idea what else I could try?
Thanks in Advance
Carlo

Error Deploying to Heroku Play 2.2 app

I think i am having a problem in my Procfile. The deploy is compiled successfully but the app does not start with this message --
2014-03-27T14:17:06.465302+00:00 heroku[api]: Deploy ea0e14d by xxxx#gmail.com
2014-03-27T14:17:06.465378+00:00 heroku[api]: Release v10 created by xxxx#gmail.com
2014-03-27T14:17:14.091032+00:00 heroku[web.1]: Starting process with command `target/universal/stage/bin/enigmatic-dusk-7498 -Dhttp.port=32253`
2014-03-27T14:17:15.199466+00:00 app[web.1]: bash: target/universal/stage/bin/enigmatic-dusk-7498: No such file or directory
2014-03-27T14:17:16.511169+00:00 heroku[web.1]: Process exited with status 127
2014-03-27T14:17:16.521177+00:00 heroku[web.1]: State changed from starting to crashed
The procfile reads:
web: target/universal/stage/bin/enigmatic-dusk-7498 -Dhttp.port=$PORT
which i guess is the standard for play 2.2 onwards.
What is wrong? enigmatic dusk is the name given by heroku to my app. my local name is different.
EDIT:
As per some suggestions i tried changing the procfile to my local app-name.
New Procfile -
web: target/universal/stage/bin/ExampleBootStrap -Dhttp.port=$PORT
Still it fails.
2014-03-27T17:58:12.527528+00:00 heroku[web.1]: Starting process with command `target/universal/stage/bin/ExampleBootStrap -Dhttp.port=38392`
2014-03-27T17:58:13.948429+00:00 app[web.1]: bash: target/universal/stage/bin/ExampleBootStrap: No such file or directory
2014-03-27T17:58:15.608461+00:00 heroku[web.1]: Process exited with status 127
2014-03-27T17:58:15.621947+00:00 heroku[web.1]: State changed from crashed to starting
2014-03-27T17:58:15.620997+00:00 heroku[web.1]: State changed from starting to crashed
2014-03-27T17:58:27.265083+00:00 heroku[web.1]: State changed from starting to crashed
2014-03-27T17:58:24.366648+00:00 heroku[web.1]: Starting process with command `target/universal/stage/bin/ExampleBootStrap -Dhttp.port=33223`
2014-03-27T17:58:25.666535+00:00 app[web.1]: bash: target/universal/stage/bin/ExampleBootStrap: No such file or directory
2014-03-27T17:58:27.250296+00:00 heroku[web.1]: Process exited with status 127
In your procfile, you must replace enigmatic-dusk-7498 with the name of your play project in lower case letters, not you heroku app.

Resources