Application Error for express app on Heroku - node.js

My app has been deployed to Heroku but I have an error. When I ran heroku logs this is what I got. What should be my next step?
2014-12-10T00:11:35.262196+00:00 heroku[api]: Release v2 created by jgallardo720#gmail.com
2014-12-10T00:11:35.262157+00:00 heroku[api]: Enable Logplex by jgallardo720#gmail.com
2014-12-10T02:11:58+00:00 heroku[slug-compiler]: Slug compilation started
2014-12-10T02:11:59+00:00 heroku[slug-compiler]: Slug compilation failed: failed to compile Node.js app
2014-12-10T02:34:19+00:00 heroku[slug-compiler]: Slug compilation started
2014-12-10T02:34:24+00:00 heroku[slug-compiler]: Slug compilation finished
2014-12-10T02:34:24.699378+00:00 heroku[api]: Scale to web=1 by jgallardo720#gmail.com
2014-12-10T02:34:24.824438+00:00 heroku[api]: Release v3 created by jgallardo720#gmail.com
2014-12-10T02:34:24.824438+00:00 heroku[api]: Deploy 2e7cde3 by jgallardo720#gmail.com
2014-12-10T02:34:27.064796+00:00 heroku[web.1]: Starting process with command `node app.js`
2014-12-10T02:34:28.830069+00:00 heroku[web.1]: State changed from starting to crashed
2014-12-10T02:34:28.830779+00:00 heroku[web.1]: State changed from crashed to starting
2014-12-10T02:34:28.817610+00:00 heroku[web.1]: Process exited with status 0
2014-12-10T02:34:30.810280+00:00 heroku[web.1]: Starting process with command `node app.js`
2014-12-10T02:34:32.713107+00:00 heroku[web.1]: Process exited with status 0
2014-12-10T02:34:32.728197+00:00 heroku[web.1]: State changed from starting to crashed
2014-12-10T02:34:37.389257+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=emofortunecookie.herokuapp.com request_id=66d97943-635d-41c9-8f16-dd8ce0cc4002 fwd="162.205.69.67" dyno= connect= service= status=503 bytes=
2014-12-10T02:34:38.127871+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=emofortunecookie.herokuapp.com request_id=fb1872cd-f7d5-4883-8e70-fdb3ac86faad fwd="162.205.69.67" dyno= connect= service= status=503 bytes=
2014-12-10T02:35:33.092921+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=emofortunecookie.herokuapp.com request_id=dab56a61-bd92-423a-ae16-3a23c501f9cd fwd="162.205.69.67" dyno= connect= service= status=503 bytes=
2014-12-10T02:35:34.138997+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=emofortunecookie.herokuapp.com request_id=702f3796-e115-488d-b9e6-3431838ccfea fwd="162.205.69.67" dyno= connect= service= status=503 bytes=
Procfile
web: node app.js
package.json
{
"name": "emofortunecookie",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www"
},
"dependencies": {
"express": "~4.9.0",
"body-parser": "~1.8.1",
"cookie-parser": "~1.3.3",
"morgan": "~1.3.0",
"serve-favicon": "~2.1.3",
"debug": "~2.0.0",
"jade": "~1.6.0",
"stylus": "0.42.3"
},
"engines": {
"node": "0.10.x",
"npm": "1.2.x"
}
}

The tutorial that I originally followed along to was outdated. So I modified the procfile.
Procfile
web: node ./bin/www

Related

why i get this error in Heroku nodejs hosting?

I have problems with heroku hosting idk what can i do. (the port probably correct: const PORT = process.env.PORT ||)
2020-09-07T20:45:20.640779+00:00 heroku[web.1]: State changed from crashed to starting
2020-09-07T20:45:20.304911+00:00 app[api]: Deploy d8237452 by user maurerkrisztian#gmail.com
2020-09-07T20:45:20.304911+00:00 app[api]: Release v7 created by user maurerkrisztian#gmail.com
2020-09-07T20:45:20.000000+00:00 app[api]: Build succeeded
2020-09-07T20:45:25.983410+00:00 heroku[web.1]: Starting process with command `npm start`
2020-09-07T20:45:28.650802+00:00 app[web.1]:
2020-09-07T20:45:28.650814+00:00 app[web.1]: > simple-rest-api#1.0.0 start /app
2020-09-07T20:45:28.650814+00:00 app[web.1]: > ts-node-dev app.ts
2020-09-07T20:45:28.650814+00:00 app[web.1]:
2020-09-07T20:45:29.326452+00:00 app[web.1]: ts-node-dev ver. 1.0.0-pre.58 (using ts-node ver. 8.10.2, typescript ver. 3.9.7)
2020-09-07T20:45:39.103732+00:00 app[web.1]: [ERROR] 20:45:39 Error: Cannot parse config file: '/app/config/production.json': SyntaxError: Unexpected end of JSON input
2020-09-07T20:46:26.541466+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2020-09-07T20:46:26.561313+00:00 heroku[web.1]: Stopping process with SIGKILL
2020-09-07T20:46:26.665093+00:00 heroku[web.1]: Process exited with status 137
2020-09-07T20:46:26.718342+00:00 heroku[web.1]: State changed from starting to crashed
2020-09-07T20:46:28.765964+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/api/echo" host=anime-stream-api.herokuapp.com request_id=d2794c21-f597-44e0-86f8-d6df00c2fac1 fwd="84.236.68.164" dyno= connect= service= status=503 bytes= protocol=https
2020-09-07T20:46:30.035002+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=anime-stream-api.herokuapp.com request_id=2a36961c-812a-412c-acb3-13b01d962394 fwd="84.236.68.164" dyno= connect= service= status=503 bytes= protocol=https
2020-09-07T20:46:34.664255+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/api/echo" host=anime-stream-api.herokuapp.com request_id=1b02724a-887e-4881-8fde-2e025fc6ed1c fwd="84.236.68.164" dyno= connect= service= status=503 bytes= protocol=https
production.json probably has an error, check if it is a valid JSON code

Heroku Node 503

I am creating a very simple Heroku NodeJS server and it is throwing the following error when I load the page:
Failed to load resource: the server responded with a status of 503 (Service Unavailable)
The code for the index.js file:
const express = require('express');
const app = express();
app.get('/', (request, res) => {
res.send('Conneccteedd!!')
}
)
app.get('/something', (request, res) => {
res.send('somethingg!!')
}
)
app.listen(3000, () => console.log('Example app listening on post 3000!'))
When I run heroku logs, I get this:
2018-04-07T17:23:59.443080+00:00 app[api]: Enable Logplex by user rcocuzzo8#gmail.com
2018-04-07T17:23:59.139900+00:00 app[api]: Release v1 created by user rcocuzzo8#gmail.com
2018-04-07T17:23:59.139900+00:00 app[api]: Initial release by user rcocuzzo8#gmail.com
2018-04-07T17:23:59.443080+00:00 app[api]: Release v2 created by user rcocuzzo8#gmail.com
2018-04-07T17:24:44.000000+00:00 app[api]: Build started by user rcocuzzo8#gmail.com
2018-04-07T17:24:52.198560+00:00 app[api]: Deploy ac13e171 by user rcocuzzo8#gmail.com
2018-04-07T17:24:52.198560+00:00 app[api]: Release v3 created by user rcocuzzo8#gmail.com
2018-04-07T17:24:52.225795+00:00 app[api]: Scaled to web#1:Free by user rcocuzzo8#gmail.com
2018-04-07T17:24:44.000000+00:00 app[api]: Build succeeded
2018-04-07T17:24:54.670733+00:00 heroku[web.1]: Starting process with command `npm start`
2018-04-07T17:24:57.221082+00:00 heroku[web.1]: Process exited with status 1
2018-04-07T17:24:57.237275+00:00 heroku[web.1]: State changed from starting to crashed
2018-04-07T17:24:57.240098+00:00 heroku[web.1]: State changed from crashed to starting
2018-04-07T17:24:57.159083+00:00 app[web.1]: npm ERR! missing script: start
2018-04-07T17:24:57.165086+00:00 app[web.1]:
2018-04-07T17:24:57.165114+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2018-04-07T17:24:57.165210+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2018-04-07T17_24_57_160Z-debug.log
2018-04-07T17:25:00.031630+00:00 heroku[web.1]: Starting process with command `npm start`
2018-04-07T17:25:02.926871+00:00 heroku[web.1]: Process exited with status 1
2018-04-07T17:25:02.833143+00:00 app[web.1]: npm ERR! missing script: start
2018-04-07T17:25:02.842169+00:00 app[web.1]:
2018-04-07T17:25:02.842516+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2018-04-07T17:25:02.842705+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2018-04-07T17_25_02_835Z-debug.log
2018-04-07T17:25:02.943109+00:00 heroku[web.1]: State changed from starting to crashed
2018-04-07T17:25:33.768543+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=gentle-crag-38927.herokuapp.com request_id=604adedc-92bb-41f9-aff8-510ef9540502 fwd="73.178.82.243" dyno= connect= service= status=503 bytes= protocol=https
2018-04-07T17:25:34.409195+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=gentle-crag-38927.herokuapp.com request_id=0e875c22-57c7-4222-88b7-182580dc5aca fwd="73.178.82.243" dyno= connect= service= status=503 bytes= protocol=https
2018-04-07T17:25:52.739291+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=gentle-crag-38927.herokuapp.com request_id=68de943d-1ec9-4b58-8c2a-1b02f330746c fwd="73.178.82.243" dyno= connect= service= status=503 bytes= protocol=https
2018-04-07T17:25:53.528379+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=gentle-crag-38927.herokuapp.com request_id=b6b7cf31-64e7-4888-9eb9-42fe65b4f9c0 fwd="73.178.82.243" dyno= connect= service= status=503 bytes= protocol=https
2018-04-07T17:27:33.130652+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=gentle-crag-38927.herokuapp.com request_id=9c3180f6-76fa-40f1-98b4-d39018991e96 fwd="73.178.82.243" dyno= connect= service= status=503 bytes= protocol=https
2018-04-07T17:27:33.494007+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=gentle-crag-38927.herokuapp.com request_id=3841d1fa-d1ca-482c-8f43-947f07e4f84d fwd="73.178.82.243" dyno= connect= service= status=503 bytes= protocol=https
2018-04-07T17:33:42.000000+00:00 app[api]: Build started by user rcocuzzo8#gmail.com
2018-04-07T17:33:52.608615+00:00 app[api]: Deploy 9d2bc566 by user rcocuzzo8#gmail.com
2018-04-07T17:33:52.608615+00:00 app[api]: Release v4 created by user rcocuzzo8#gmail.com
2018-04-07T17:33:42.000000+00:00 app[api]: Build succeeded
2018-04-07T17:33:54.281891+00:00 heroku[web.1]: State changed from crashed to starting
2018-04-07T17:33:57.242836+00:00 heroku[web.1]: Starting process with command `npm start`
2018-04-07T17:33:59.949160+00:00 app[web.1]:
2018-04-07T17:33:59.949177+00:00 app[web.1]: > first#1.0.0 start /app
2018-04-07T17:33:59.949179+00:00 app[web.1]: > node index.js
2018-04-07T17:33:59.949181+00:00 app[web.1]:
2018-04-07T17:34:00.317195+00:00 app[web.1]: Example app listening on post 3000!
2018-04-07T17:34:57.440018+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2018-04-07T17:34:57.440165+00:00 heroku[web.1]: Stopping process with SIGKILL
2018-04-07T17:34:57.554675+00:00 heroku[web.1]: Process exited with status 137
2018-04-07T17:34:57.575996+00:00 heroku[web.1]: State changed from starting to crashed
2018-04-07T17:35:07.163337+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=gentle-crag-38927.herokuapp.com request_id=872ac12e-8d25-40c9-a6c8-304a6e8aab42 fwd="73.178.82.243" dyno= connect= service= status=503 bytes= protocol=https
2018-04-07T17:35:07.584580+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=gentle-crag-38927.herokuapp.com request_id=0534531c-1a76-46a9-9fc0-54c0c814387e fwd="73.178.82.243" dyno= connect= service= status=503 bytes= protocol=https
2018-04-07T17:44:18.000000+00:00 app[api]: Build started by user rcocuzzo8#gmail.com
2018-04-07T17:44:27.830483+00:00 heroku[web.1]: State changed from crashed to starting
2018-04-07T17:44:27.611180+00:00 app[api]: Release v5 created by user rcocuzzo8#gmail.com
2018-04-07T17:44:27.611180+00:00 app[api]: Deploy f1d3f52b by user rcocuzzo8#gmail.com
2018-04-07T17:44:18.000000+00:00 app[api]: Build succeeded
2018-04-07T17:44:29.667502+00:00 heroku[web.1]: Starting process with command `npm start`
2018-04-07T17:44:32.132423+00:00 app[web.1]:
2018-04-07T17:44:32.132444+00:00 app[web.1]: > first#1.0.0 start /app
2018-04-07T17:44:32.132445+00:00 app[web.1]: > node index.js
2018-04-07T17:44:32.132446+00:00 app[web.1]:
2018-04-07T17:44:32.322170+00:00 app[web.1]: Example app listening on post 3000!
where it seems to be pointing at the lack of a start test, but here is my package.json file (which contains the script):
{
"name": "first",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Rcuz8/express-server-01.git"
},
"author": "cocuzzo",
"license": "ISC",
"bugs": {
"url": "https://github.com/Rcuz8/express-server-01/issues"
},
"homepage": "https://github.com/Rcuz8/express-server-01#readme",
"dependencies": {
"express": "^4.16.3"
}
}
And, lastly, here is what the site looks like with the console open:
If you would like a better visual for the code: here is the GitHub
From comments:
Why port 3000? How does Heroku know to proxy traffic to that port?
const PORT = process.env.PORT || 3000;
app.listen(PORT);

Bootstrap with Gulp app won't launch from Heroku

I have a web site built with Bootstrap and Gulp on a NodeJS framework. Gulp basically just compiles changes and routes things, but isn't a server. I have my package.json file scripts section set to run Gulp on start. I have pushed everything to Github and then to Heroku for deployment. When I try to launch it from Heroku, nothing happens. I just get the following message: An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. Below is the log and my package.json file. Do I need to go back and add something like Express/server.js just to get it to run (with dynamic port setting)?
{
"name": "bs4starter",
"version": "1.0.0",
"description": "Bootstrap 4 workflow",
"main": "index.js",
"scripts": {
"start": "gulp"
},
"author": "Justin Bridwell",
"license": "MIT",
"dependencies": {
"bootstrap": "4.0.0-beta",
"font-awesome": "^4.7.0",
"jquery": "^3.2.1",
"popper.js": "^1.12.0"
},
"devDependencies": {
"browser-sync": "^2.18.13",
"gulp": "^3.9.1",
"gulp-sass": "^3.1.0"
}
}
Here is the Heroku log:
2018-02-20T21:46:01.209374+00:00 app[web.1]: npm ERR! Failed at the
bs4starter#1.0.0 start script.
2018-02-20T21:46:01.209612+00:00 app[web.1]: npm ERR! This is probably not
a problem with npm. There is likely additional logging output above.
2018-02-20T21:46:01.223672+00:00 app[web.1]:
2018-02-20T21:46:01.224004+00:00 app[web.1]: npm ERR! A complete log of
this run can be found in:
2018-02-20T21:46:01.224195+00:00 app[web.1]: npm ERR!
/app/.npm/_logs/2018-02-20T21_46_01_217Z-debug.log
2018-02-23T14:23:21.846098+00:00 heroku[router]: at=error code=H10
desc="App crashed" method=GET path="/" host=polar-caverns-
42095.herokuapp.com request_id=5e788478-e16d-4f2e-a060-106ab9ec81ed
fwd="73.147.231.118" dyno= connect= service= status=503 bytes=
protocol=https
2018-02-23T14:23:22.058194+00:00 heroku[router]: at=error code=H10
desc="App crashed" method=GET path="/favicon.ico" host=polar-caverns-
42095.herokuapp.com request_id=0833d754-afce-48fd-94f7-25900fb9d4cd
fwd="73.147.231.118" dyno= connect= service= status=503 bytes=
protocol=https
2018-02-26T21:26:20.770745+00:00 heroku[router]: at=error code=H10
desc="App crashed" method=GET path="/" host=polar-caverns-
42095.herokuapp.com request_id=6fc50be9-40aa-4922-9a76-955947e78478
fwd="73.147.231.118" dyno= connect= service= status=503 bytes=
protocol=https
2018-02-26T21:26:21.390897+00:00 heroku[router]: at=error code=H10
desc="App crashed" method=GET path="/favicon.ico" host=polar-caverns-
42095.herokuapp.com request_id=73f17c20-7aa3-48d0-86df-5bd5f4dea85a
fwd="73.147.231.118" dyno= connect= service= status=503 bytes=
protocol=https
2018-02-27T13:31:51.110344+00:00 heroku[router]: at=error code=H10
desc="App crashed" method=GET path="/" host=polar-caverns-
42095.herokuapp.com request_id=06f192f8-c5a2-4327-bef1-dc3d9dfa27b2
fwd="73.147.231.118" dyno= connect= service= status=503 bytes=
protocol=https
2018-02-27T13:31:51.317319+00:00 heroku[router]: at=error code=H10
desc="App crashed" method=GET path="/favicon.ico" host=polar-caverns-
42095.herokuapp.com request_id=c02a6c07
-98f4-4b3e-b2c6-c3636e6123e9 fwd="73.147.231.118" dyno= connect= service=
status=503 bytes= protocol=https

Keep getting an application error when trying to deploy a node app in heroku

I have been having difficulties deploying on heroku. Followed the deploying a node js app on heroku guide but still keep getting an application error. any idea why please? here is my heroku logs
heroku logs
2015-10-27T19:48:35.704758+00:00 heroku[api]: Enable Logplex by chineduabalogu#gmail.com
2015-10-27T19:48:35.704758+00:00 heroku[api]: Release v2 created by chineduabalogu#gmail.com
2015-10-27T19:57:58.536860+00:00 heroku[slug-compiler]: Slug compilation started
2015-10-27T19:57:58.536871+00:00 heroku[slug-compiler]: Slug compilation finished
2015-10-27T19:57:58.397214+00:00 heroku[api]: Scale to web=1 by chineduabalogu#gmail.com
2015-10-27T19:57:58.466140+00:00 heroku[api]: Deploy 51bdb1d by chineduabalogu#gmail.com
2015-10-27T19:57:58.466140+00:00 heroku[api]: Release v3 created by chineduabalogu#gmail.com
2015-10-27T19:58:00.692453+00:00 heroku[web.1]: Starting process with command `npm start`
2015-10-27T19:58:03.827532+00:00 app[web.1]:
2015-10-27T19:58:03.827554+00:00 app[web.1]: > node app.js
2015-10-27T19:58:03.827552+00:00 app[web.1]: > gf17#0.0.1 start /app
2015-10-27T19:58:03.827555+00:00 app[web.1]:
2015-10-27T19:58:04.616168+00:00 app[web.1]: Express server listening on port 3000
2015-10-27T19:59:00.972722+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2015-10-27T19:59:00.972722+00:00 heroku[web.1]: Stopping process with SIGKILL
2015-10-27T19:59:01.940288+00:00 heroku[web.1]: State changed from starting to crashed
2015-10-27T19:59:01.941567+00:00 heroku[web.1]: State changed from crashed to starting
2015-10-27T19:59:01.932037+00:00 heroku[web.1]: Process exited with status 137
2015-10-27T19:59:04.247002+00:00 heroku[web.1]: Starting process with command `npm start`
2015-10-27T19:59:07.923766+00:00 app[web.1]:
2015-10-27T19:59:07.923776+00:00 app[web.1]: > gf17#0.0.1 start /app
2015-10-27T19:59:07.923778+00:00 app[web.1]: > node app.js
2015-10-27T19:59:07.923779+00:00 app[web.1]:
2015-10-27T19:59:09.513389+00:00 app[web.1]: Express server listening on port 3000
2015-10-27T20:00:04.705994+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2015-10-27T20:00:04.705994+00:00 heroku[web.1]: Stopping process with SIGKILL
2015-10-27T20:00:05.657468+00:00 heroku[web.1]: State changed from starting to crashed
2015-10-27T20:00:05.644215+00:00 heroku[web.1]: Process exited with status 137
2015-10-27T20:17:45.559370+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=evening-fjord-8286.herokuapp.com request_id=ce9f7865-5431-4514-83e3-9228df351291 fwd="154.118.30.203" dyno= connect= service= status=503 bytes=
2015-10-27T20:17:46.110795+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=evening-fjord-8286.herokuapp.com request_id=e7b1f9b7-4600-4ce7-b90c-3239a82abcb9 fwd="154.118.30.203" dyno= connect= service= status=503 bytes=
2015-10-27T20:17:48.086903+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=evening-fjord-8286.herokuapp.com request_id=8a41518c-cfd8-4dac-8622-1f94de9346b3 fwd="198.15.118.148" dyno= connect= service= status=503 bytes=
2015-10-27T20:17:48.543167+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=evening-fjord-8286.herokuapp.com request_id=e1ce271b-7a76-43c1-931e-0ac9a375cfb7 fwd="154.118.30.203" dyno= connect= service= status=503 bytes=
2015-10-27T20:19:48.784831+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=evening-fjord-8286.herokuapp.com request_id=9229308a-6604-4426-8ba6-4cabb8b94de9 fwd="154.118.30.203" dyno= connect= service= status=503 bytes=
2015-10-27T20:19:49.552910+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=evening-fjord-8286.herokuapp.com request_id=e542cc92-ca00-4044-8c23-76642887ef35 fwd="154.118.30.203" dyno= connect= service= status=503 bytes=
2015-10-27T20:22:17.304691+00:00 heroku[web.1]: State changed from crashed to starting
2015-10-27T20:22:19.261727+00:00 heroku[web.1]: Starting process with command `npm start`
2015-10-27T20:22:21.447920+00:00 app[web.1]:
2015-10-27T20:22:21.447934+00:00 app[web.1]: > gf17#0.0.1 start /app
2015-10-27T20:22:21.447935+00:00 app[web.1]: > node app.js
2015-10-27T20:22:21.447936+00:00 app[web.1]:
2015-10-27T20:22:22.123539+00:00 app[web.1]: Express server listening on port 3000
2015-10-27T20:23:19.916089+00:00 heroku[web.1]: Stopping process with SIGKILL
2015-10-27T20:23:19.916089+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2015-10-27T20:23:20.780482+00:00 heroku[web.1]: Process exited with status 137
2015-10-27T20:23:20.792567+00:00 heroku[web.1]: State changed from starting to crashed
2015-10-27T20:25:54.984210+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=evening-fjord-8286.herokuapp.com request_id=83eec29d-598c-44d1-b6bc-55933e60013f fwd="154.118.30.203" dyno= connect= service= status=503 bytes=
2015-10-27T20:25:56.659875+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=evening-fjord-8286.herokuapp.com request_id=c384f7e6-e6e9-4088-bdf1-b7370b572b68 fwd="154.118.30.203" dyno= connect= service= status=503 bytes=
From your logs, it looks like you are NOT binding to the right port.
I'm going to assume that your Express.js app looks something like this:
app.listen(3000);
This line of code tells Express.js to start running a web server on port 3000. This is fine when you're writing code on your laptop, but when you deploy code to Heroku, Heroku will assign you a RANDOM port number that you MUST bind to.
So, to fix your problem, you should rewrite the above line of code to look like this:
app.listen(process.env.PORT || 3000);
This will tell your app to run on the correct Heroku port, but fall back to port 3000 when doing development on your local laptop =) This is the best of both worlds.
Hope this helps!

Heroku Nodejs app with R10, H10 and H20 errors

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 vietminhle98#gmail.com
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 vietminhle98#gmail.com
2013-09-08T01:14:28.351861+00:00 heroku[api]: Add PATH config by vietminhle98#gmail.com
2013-09-08T01:14:28.382733+00:00 heroku[api]: Release v3 created by vietminhle98#gmail.com
2013-09-08T01:14:28.426015+00:00 heroku[api]: Deploy 6be3e0c by vietminhle98#gmail.com
2013-09-08T01:14:28.439849+00:00 heroku[api]: Release v4 created by vietminhle98#gmail.com
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 vietminhle98#gmail.com
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 vietminhle98#gmail.com
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 vietminhle98#gmail.com
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
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)
Maybe your wrong listen port?
Check your app port,look up if there is set to process.env.PORT || 3000.
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.
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.

Resources