Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Heroku Nodejs app with R10, H10 and H20 errors

Tags:

node.js

heroku

I tried to run my nodejs app[using socket.io]. I deployed it with no error. But when I run it, I got this:

2013-09-07T01:13:09.697674+00:00 heroku[api]: Release v2 created by [email protected]
2013-09-07T12:15:57.148172+00:00 heroku[router]: at=info code= desc="Blank app" method=GET 

    path=/ host=fnboard.herokuapp.com fwd="122.109.112.187" dyno= connect= service= status=502 bytes=
2013-09-07T12:15:57.672631+00:00 heroku[router]: at=info code= desc="Blank app" method=GET path=/favicon.ico host=fnboard.herokuapp.com fwd="122.109.112.187" dyno= connect= service= status=502 bytes=
2013-09-08T01:14:00+00:00 heroku[slug-compiler]: Slug compilation started
2013-09-08T01:14:28.327510+00:00 heroku[api]: Scale to web=1 by [email protected]
2013-09-08T01:14:28.351861+00:00 heroku[api]: Add PATH config by [email protected]
2013-09-08T01:14:28.382733+00:00 heroku[api]: Release v3 created by [email protected]
2013-09-08T01:14:28.426015+00:00 heroku[api]: Deploy 6be3e0c by [email protected]
2013-09-08T01:14:28.439849+00:00 heroku[api]: Release v4 created by [email protected]
2013-09-08T01:14:28+00:00 heroku[slug-compiler]: Slug compilation finished
2013-09-08T01:14:32.477748+00:00 heroku[web.1]: Starting process with command `node server.js`
2013-09-08T01:14:34.751076+00:00 app[web.1]: LISTENING
2013-09-08T01:14:35.314545+00:00 app[web.1]: info: socket.io started
2013-09-08T01:15:34.427477+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2013-09-08T01:15:34.427784+00:00 heroku[web.1]: Stopping process with SIGKILL
2013-09-08T01:15:35.676986+00:00 heroku[web.1]: State changed from starting to crashed
2013-09-08T01:15:35.676986+00:00 heroku[web.1]: State changed from crashed to starting
2013-09-08T01:15:35.663597+00:00 heroku[web.1]: Process exited with status 137
2013-09-08T01:15:37.774955+00:00 heroku[web.1]: Starting process with command `node server.js`
2013-09-08T01:15:38.653254+00:00 app[web.1]: LISTENING
2013-09-08T01:15:38.755820+00:00 app[web.1]: info: socket.io started
2013-09-08T01:15:59.434156+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path=/ host=fnboard.herokuapp.com fwd="122.109.112.187" dyno= connect= service= status=503 bytes=
2013-09-08T01:16:27.246666+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path=/ host=fnboard.herokuapp.com fwd="122.109.112.187" dyno= connect= service= status=503 bytes=
2013-09-08T01:16:38.781151+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2013-09-08T01:16:38.781376+00:00 heroku[web.1]: Stopping process with SIGKILL
2013-09-08T01:16:39.983421+00:00 heroku[web.1]: Process exited with status 137
2013-09-08T01:16:40.011325+00:00 heroku[web.1]: State changed from starting to crashed
2013-09-08T01:16:41.541487+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=fnboard.herokuapp.com fwd="122.109.112.187" dyno= connect= service= status=503 bytes=
2013-09-08T01:18:44.971726+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=fnboard.herokuapp.com fwd="122.109.112.187" dyno= connect= service= status=503 bytes=
2013-09-08T01:18:47.279357+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=fnboard.herokuapp.com fwd="122.109.112.187" dyno= connect= service= status=503 bytes=
2013-09-08T01:20:09.452479+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=fnboard.herokuapp.com fwd="122.109.112.187" dyno= connect= service= status=503 bytes=
2013-09-08T01:20:08.839678+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=fnboard.herokuapp.com fwd="122.109.112.187" dyno= connect= service= status=503 bytes=
2013-09-08T01:26:06.279799+00:00 heroku[web.1]: State changed from crashed to starting
2013-09-08T01:26:08.503114+00:00 heroku[web.1]: Starting process with command `node server.js`
2013-09-08T01:26:09.522676+00:00 app[web.1]: LISTENING
2013-09-08T01:26:09.656509+00:00 app[web.1]: info: socket.io started
2013-09-08T01:27:09.615998+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2013-09-08T01:27:09.616415+00:00 heroku[web.1]: Stopping process with SIGKILL
2013-09-08T01:27:10.895911+00:00 heroku[web.1]: Process exited with status 137
2013-09-08T01:27:10.909789+00:00 heroku[web.1]: State changed from starting to crashed
2013-09-08T01:27:13.347426+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=fnboard.herokuapp.com fwd="122.109.112.187" dyno= connect= service= status=503 bytes=
2013-09-08T01:27:14.033545+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=fnboard.herokuapp.com fwd="122.109.112.187" dyno= connect= service= status=503 bytes=
2013-09-08T01:28:02.549578+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=fnboard.herokuapp.com fwd="122.109.112.187" dyno= connect= service= status=503 bytes=
2013-09-08T01:28:06.335482+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/index.html host=fnboard.herokuapp.com fwd="122.109.112.187" dyno= connect= service= status=503 bytes=
2013-09-08T01:28:07.041450+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=fnboard.herokuapp.com fwd="122.109.112.187" dyno= connect= serv
ice= status=503 bytes=
2013-09-08T01:34:23.479191+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/index.html host=fnboard.herokuapp.com fwd="122.109.112.187" dyno= connect= service= status=503 bytes=
2013-09-08T01:34:24.942938+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=fnboard.herokuapp.com fwd="122.109.112.187" dyno= connect= service= status=503 bytes=
2013-09-08T01:34:29.678584+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=fnboard.herokuapp.com fwd="122.109.112.187" dyno= connect= service= status=503 bytes=
2013-09-08T01:34:29.090141+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=fnboard.herokuapp.com fwd="122.109.112.187" dyno= connect= service= status=503 bytes=
2013-09-08T01:36:38.073605+00:00 heroku[web.1]: State changed from crashed to starting
2013-09-08T01:36:41.051197+00:00 heroku[web.1]: Starting process with command `node server.js`
2013-09-08T01:36:42.526835+00:00 app[web.1]: LISTENING
2013-09-08T01:36:42.927958+00:00 app[web.1]: info: socket.io started
2013-09-08T01:37:02.906047+00:00 heroku[api]: Scale to web=1 by [email protected]
2013-09-08T01:37:43.000152+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2013-09-08T01:37:43.000399+00:00 heroku[web.1]: Stopping process with SIGKILL
2013-09-08T01:37:44.751965+00:00 heroku[web.1]: Process exited with status 137
2013-09-08T01:37:44.766078+00:00 heroku[web.1]: State changed from starting to crashed
2013-09-08T01:45:39.155699+00:00 heroku[api]: Starting process with command `rake db:migrate` by [email protected]
2013-09-08T01:45:41.607954+00:00 heroku[run.2140]: Awaiting client
2013-09-08T01:45:42.584829+00:00 heroku[run.2140]: Starting process with command `rake db:migrate`
2013-09-08T01:45:43.920789+00:00 heroku[run.2140]: Process exited with status 1
2013-09-08T01:45:43.935727+00:00 heroku[run.2140]: State changed from starting to complete
2013-09-08T01:46:55.968060+00:00 heroku[web.1]: State changed from crashed to starting
2013-09-08T01:46:58.347733+00:00 heroku[web.1]: Starting process with command `node server.js`
2013-09-08T01:47:00.425372+00:00 app[web.1]: LISTENING
2013-09-08T01:47:00.582876+00:00 app[web.1]: info: socket.io started
2013-09-08T01:47:59.952712+00:00 heroku[web.1]: Stopping process with SIGKILL
2013-09-08T01:47:59.952459+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2013-09-08T01:48:01.523065+00:00 heroku[web.1]: Process exited with status 137
2013-09-08T01:49:02.687355+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=fnboard.herokuapp.com fwd="122.109.112.187" dyno= connect= service= status=503 bytes=
2013-09-08T01:49:03.561165+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=fnboard.herokuapp.com fwd="122.109.112.187" dyno= connect= service= status=503 bytes=
2013-09-08T01:48:01.532500+00:00 heroku[web.1]: State changed from starting to crashed
2013-09-08T01:50:30.232096+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=fnboard.herokuapp.com fwd="122.109.112.187" dyno= connect= service= status=503 bytes=
2013-09-08T01:50:29.121508+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=fnboard.herokuapp.com fwd="122.109.112.187" dyno= connect= service= status=503 bytes=
2013-09-08T01:50:49.246283+00:00 heroku[web.1]: State changed from crashed to starting
2013-09-08T01:50:51.161871+00:00 heroku[web.1]: Starting process with command `node server.js`
2013-09-08T01:50:51.827825+00:00 app[web.1]: LISTENING
2013-09-08T01:50:51.945835+00:00 app[web.1]: info: socket.io started
2013-09-08T01:51:51.972737+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2013-09-08T01:51:51.972975+00:00 heroku[web.1]: Stopping process with SIGKILL
2013-09-08T01:51:53.141508+00:00 heroku[web.1]: Process exited with status 137
2013-09-08T01:51:53.152332+00:00 heroku[web.1]: State changed from starting to crashed
2013-09-08T01:51:54.484616+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=fnboard.herokuapp.com fwd="122.109.112.187" dyno= connect= service= status=503 bytes=
2013-09-08T01:51:55.899914+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=fnboard.herokuapp.com fwd="122.109.112.187" dyno= connect= service= status=503 bytes=
2013-09-08T01:52:19.791497+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=fnboard.herokuapp.com fwd="122.109.112.187" dyno= connect= service= status=503 bytes=
2013-09-08T01:52:20.616151+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=fnboard.herokuapp.com fwd="122.109.112.187" dyno= connect= service= status=503 bytes=
2013-09-08T01:52:39.086637+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=fnboard.herokuapp.com fwd="122.109.112.187" dyno= connect= service= status=503 bytes=
2013-09-08T01:52:39.688008+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=fnboard.herokuapp.com fwd="122.109.112.187" dyno= connect= service= status=503 bytes=
2013-09-08T01:51:54.508738+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=fnboard.herokuapp.com fwd="122.109.112.187" dyno= connect= service= status=503 bytes=
2013-09-08T01:51:55.281138+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=fnboard.herokuapp.com fwd="122.109.112.187" dyno= connect= service= status=503 bytes=
2013-09-08T01:54:03.778339+00:00 heroku[api]: Starting process with command `bash` by [email protected]
2013-09-08T01:54:07.822098+00:00 heroku[run.9425]: Awaiting client
2013-09-08T01:54:07.856807+00:00 heroku[run.9425]: Starting process with command `bash`
2013-09-08T01:54:08.924087+00:00 heroku[run.9425]: State changed from starting to up
2013-09-08T01:54:24.533998+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=fnboard.herokuapp.com fwd="122.109.112.187" dyno= connect= service= status=503 bytes=
2013-09-08T01:54:25.693218+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=fnboard.herokuapp.com fwd="122.109.112.187" dyno= connect= service= status=503 bytes=
2013-09-08T01:54:28.098195+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=fnboard.herokuapp.com fwd="122.109.112.187" dyno= connect= service= status=503 bytes=
2013-09-08T01:54:28.648493+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=fnboard.herokuapp.com fwd="122.109.112.187" dyno= connect= service= status=503 bytes=
2013-09-08T01:56:27.247187+00:00 heroku[run.9425]: Process exited with status 1
2013-09-08T01:56:27.257609+00:00 heroku[run.9425]: State changed from up to complete

That's the complete logs. I scanned through it and find 3 errors: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch

at=error code=H20 desc="App boot timeout" method=GET path=/ host=fnboard.herokuapp.com fwd="122.109.112.187" dyno= connect= service= status=503 bytes=

at=error code=H10 desc="App crashed" method=GET path=/ host=fnboard.herokuapp.com fwd="122.109.112.187" dyno= connect= service= status=503 bytes=

I dont know why these three errors happen at the same time and I dont know what's wrong with my app, please help

My package.json:

{
"name": "fnBoard",
  "version": "0.0.1",
  "private": true,
  "scripts": {
  "start": "node server.js"
 },
  "dependencies": {
    "socket.io": "0.9.x"
  },
    "engines": {
     "node": "0.10.x",
     "npm": "1.3.x"
  }
}

Procfile:

web: node server.js

.gitignore:

node_modules
like image 575
Pixeladed Avatar asked Sep 08 '13 02:09

Pixeladed


People also ask

Why is my node js app crashing with an H10 error?

This error is thrown in a Node. js environment if you forget to set a start script . Heroku uses this script to start your app so if it is missing, it would throw an H10-App crashed error code message.

What is application Error in Heroku?

"Application Error" or similar is always caused by your own application code. Routing errors will normally only surface themselves within the logs of your application. To track this kind of issue down you should look at your logs: $ heroku logs --tail --app your_app_name.


4 Answers

One of your log says:

2013-09-08T01:15:34.427477+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch

To solve this, use the following for port number:

var port_number = server.listen(process.env.PORT || 3000);
app.listen(port_number);

Heroku sets a dynamically assigned port number to your app. Hence if you are strictly specifying a port number to be used, Heroku won't be able to do that.

However, you should set a port number so that your app can execute on localhost. Hence, the pipe to a specified port number '3000'.

Found this answer from Heroku + node.js error (Web process failed to bind to $PORT within 60 seconds of launch)

like image 78
Rakib Avatar answered Oct 23 '22 21:10

Rakib


Listening to 127.0.0.1 leads to the code=H20 desc="App boot timeout" problem for us. Changing the listening address to 0.0.0.0 solves the problem.

Also, don't use your own port, but instead use the environment variable PORT , which is passed to your app environment variables by heroku. Otherwise, you'll also get this problem.

Here is our node code:

const { PORT=3000, LOCAL_ADDRESS='0.0.0.0' } = process.env
server.listen(PORT, LOCAL_ADDRESS, () => {
  const address = server.address();
  console.log('server listening at', address);
});

So, try to log your listening address and port and check them firstly.

like image 41
Iceberg Avatar answered Oct 23 '22 19:10

Iceberg


Maybe your wrong listen port? Check your app port,look up if there is set to process.env.PORT || 3000.

like image 33
Allen Avatar answered Oct 23 '22 21:10

Allen


I get this error when i write wrong command in the package.json : i wrote :

"scripts" : {
  "start": "index.js"
}

instead of :

"scripts" : {
  "start": "node index.js"
}

when i wrote node index.js I'm all set.

like image 20
Yazdan Avatar answered Oct 23 '22 19:10

Yazdan