Reputation: 3219
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 [email protected]
2018-04-07T17:23:59.139900+00:00 app[api]: Release v1 created by user [email protected]
2018-04-07T17:23:59.139900+00:00 app[api]: Initial release by user [email protected]
2018-04-07T17:23:59.443080+00:00 app[api]: Release v2 created by user [email protected]
2018-04-07T17:24:44.000000+00:00 app[api]: Build started by user [email protected]
2018-04-07T17:24:52.198560+00:00 app[api]: Deploy ac13e171 by user [email protected]
2018-04-07T17:24:52.198560+00:00 app[api]: Release v3 created by user [email protected]
2018-04-07T17:24:52.225795+00:00 app[api]: Scaled to web@1:Free by user [email protected]
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 [email protected]
2018-04-07T17:33:52.608615+00:00 app[api]: Deploy 9d2bc566 by user [email protected]
2018-04-07T17:33:52.608615+00:00 app[api]: Release v4 created by user [email protected]
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]: > [email protected] 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 [email protected]
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 [email protected]
2018-04-07T17:44:27.611180+00:00 app[api]: Deploy f1d3f52b by user [email protected]
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]: > [email protected] 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
Upvotes: 2
Views: 6403
Reputation: 3247
From comments: Why port 3000? How does Heroku know to proxy traffic to that port?
Upvotes: 8