Application error while opening URL for app deployed in Heroku - node.js

I have deployed my webpage on Heroku, with MongoAtlas for hosting database. The site has been deployed successfully, but on opening the URL it shows the following error.
An error occurred in the application and your page could not be
served. If you are the application owner, check your logs for details.
You can do this from the Heroku CLI with the command heroku logs
--tail
The logs show this
2020-06-10T10:31:25.558083+00:00 heroku[web.1]: Stopping process with SIGKILL
2020-06-10T10:31:25.676299+00:00 heroku[web.1]: Process exited with status 137
2020-06-10T10:31:25.723593+00:00 heroku[web.1]: State changed from starting to crashed
2020-06-11T04:42:15.117508+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=immense-harbor-74512.herokuapp.com request_id=cd4e6bba-2b33-447a-9b73-da66c77c4946 fwd=
"47.9.8.24" dyno= connect= service= status=503 bytes= protocol=https
2020-06-11T04:42:15.971379+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=immense-harbor-74512.herokuapp.com request_id=b5b1c208-bd9e-48b3-9c96-d8b79a
af9123 fwd="47.9.8.24" dyno= connect= service= status=503 bytes= protocol=https
2020-06-11T04:42:37.965020+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=immense-harbor-74512.herokuapp.com request_id=52f3dcab-4f12-41cd-96dd-12856fbfb240 fwd=
"47.9.8.24" dyno= connect= service= status=503 bytes= protocol=https
What is the problem and how to solve it

Related

Cannot run my node app on Heroku. I attached the log [duplicate]

This question already has answers here:
Heroku + node.js error (Web process failed to bind to $PORT within 60 seconds of launch)
(38 answers)
Closed 2 years ago.
My node app worked fine when I hosted it in Glitch and DigitalOcean server.
But it doesn't work when I try in Heroku.
Here's the log I get after running heroku logs --tail:
› Warning: heroku update available from 7.35.0 to 7.39.5.
2020-04-24T18:56:56.066168+00:00 app[api]: Initial release by user
cuinjune#gmail.com 2020-04-24T18:56:56.167629+00:00 app[api]: Enable
Logplex by user cuinjune#gmail.com 2020-04-24T18:56:56.167629+00:00
app[api]: Release v2 created by user cuinjune#gmail.com
2020-04-24T18:56:56.066168+00:00 app[api]: Release v1 created by user
cuinjune#gmail.com 2020-04-24T18:57:07.000000+00:00 app[api]: Build
started by user cuinjune#gmail.com 2020-04-24T18:57:25.352788+00:00
app[api]: Deploy 1958e9f7 by user cuinjune#gmail.com
2020-04-24T18:57:25.370743+00:00 app[api]: Scaled to web#1:Free by
user cuinjune#gmail.com 2020-04-24T18:57:25.352788+00:00 app[api]:
Release v3 created by user cuinjune#gmail.com
2020-04-24T18:57:26.000000+00:00 app[api]: Build succeeded
2020-04-24T18:57:30.065364+00:00 app[web.1]:
2020-04-24T18:57:30.065389+00:00 app[web.1]: > battle-square#1.0.0
start /app 2020-04-24T18:57:30.065389+00:00 app[web.1]: > node
index.js 2020-04-24T18:57:30.065390+00:00 app[web.1]:
2020-04-24T18:57:30.206325+00:00 app[web.1]: Server is running
localhost on port: 3000 2020-04-24T18:58:28.351045+00:00
heroku[web.1]: State changed from starting to crashed
2020-04-24T18:58:28.354624+00:00 heroku[web.1]: State changed from
crashed to starting 2020-04-24T18:58:33.378248+00:00 app[web.1]:
2020-04-24T18:58:33.378282+00:00 app[web.1]: > battle-square#1.0.0
start /app 2020-04-24T18:58:33.378283+00:00 app[web.1]: > node
index.js 2020-04-24T18:58:33.378283+00:00 app[web.1]:
2020-04-24T18:58:33.576646+00:00 app[web.1]: Server is running
localhost on port: 3000 2020-04-24T18:58:52.316240+00:00
heroku[router]: at=error code=H20 desc="App boot timeout" method=GET
path="/" host=secure-eyrie-48591.herokuapp.com
request_id=6ee36c25-45d3-4e0a-aae0-c9ddc89e1b69 fwd="69.116.190.29"
dyno= connect= service= status=503 bytes= protocol=https
2020-04-24T18:59:31.070175+00:00 heroku[web.1]: State changed from
starting to crashed 2020-04-24T18:59:38.566167+00:00 heroku[router]:
at=error code=H10 desc="App crashed" method=GET path="/"
host=secure-eyrie-48591.herokuapp.com
request_id=55127020-5b19-4154-885f-79287266284a fwd="69.116.190.29"
dyno= connect= service= status=503 bytes= protocol=https
2020-04-24T18:59:39.185406+00:00 heroku[router]: at=error code=H10
desc="App crashed" method=GET path="/favicon.ico"
host=secure-eyrie-48591.herokuapp.com
request_id=0f99d119-de28-4e80-a22d-0dab655469f7 fwd="69.116.190.29"
dyno= connect= service= status=503 bytes= protocol=https
2020-04-24T19:00:26.640037+00:00 heroku[router]: at=error code=H10
desc="App crashed" method=GET path="/"
host=secure-eyrie-48591.herokuapp.com
request_id=462f5dd6-c6ee-42d2-9251-50894d822936 fwd="69.116.190.29"
dyno= connect= service= status=503 bytes= protocol=https
2020-04-24T19:00:27.065538+00:00 heroku[router]: at=error code=H10
desc="App crashed" method=GET path="/favicon.ico"
host=secure-eyrie-48591.herokuapp.com
request_id=5e8e1903-9520-4c1e-a468-aecb35ba453f fwd="69.116.190.29"
dyno= connect= service= status=503 bytes= protocol=https
2020-04-24T19:06:10.144325+00:00 heroku[router]: at=error code=H10
desc="App crashed" method=GET path="/"
host=secure-eyrie-48591.herokuapp.com
request_id=ca404bc9-b117-42c9-82db-db08862572a8 fwd="69.116.190.29"
dyno= connect= service= status=503 bytes= protocol=https
2020-04-24T19:06:10.679020+00:00 heroku[router]: at=error code=H10
desc="App crashed" method=GET path="/favicon.ico"
host=secure-eyrie-48591.herokuapp.com
request_id=c18910bc-34ad-4ae0-8d88-b1dfbfed00f9 fwd="69.116.190.29"
dyno= connect= service= status=503 bytes= protocol=https
And here's the link to my repo: https://github.com/cuinjune/battle-square
What's the problem and how to fix this?
The cause is in the logs: Server is running localhost on port: 3000.
The app is using port 3000, locally is fine but Heroku gives you a dynamic port upon deployment, therefore you need to bind to this port which is provided through the env variable $PORT

Error while deploying app(Nodejs + sqlite3) on Heroku

I am trying to deploy my app (Node.js) on Heroku which uses a sqlite3 database, deployment is done but while running the app I am getting the following error:
2020-04-23T10:07:50.747074+00:00 app[web.1]: App started on port 5000
2020-04-23T10:07:50.748081+00:00 app[web.1]: Connected to the SQLite database.
2020-04-23T10:07:50.748081+00:00 app[web.1]: Connected to the SQLite database.
2020-04-23T10:08:48.280947+00:00 heroku[web.1]: State changed from starting to crashed
2020-04-23T10:08:52.004314+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=backendthemesdemo.herokuapp.com request_id=470f5cfb-58e4-4ab0-b666-14880d5c31a8 fwd="43.241.194.49" dyno= connect= service= status=503 bytes= protocol=https
2020-04-23T10:08:53.642688+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=backendthemesdemo.herokuapp.com request_id=f2d12092-9809-463b-89c1-eb5fcd8b267f fwd="43.241.194.49" dyno= connect= service= status=503 bytes= protocol=https
2020-04-23T10:30:38.831607+00:00 heroku[web.1]: State changed from crashed to starting

Need help solving why my app crashed and getting the H10 error method GET

How to resolve this error, n open heroku app:
2018-12-26T22:50:56.636727+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=young-springs-33489.herokuapp.com request_id=cdc49a54-7667-4406-bb48-9347699e2eb3 fwd="24.216.55.31" dyno= connect= service= status=503 bytes= protocol=https

Heroku error code=H10

I keep getting error code=H10 randomly when I start my Heroku app. Sometimes the app starts, sometimes it doesn't.
My app is built with NodeJS, Express, MySQL and JawsDB.
Here's the details in my app's log:
2017-11-26T15:21:36.906937+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=<my app name>.herokuapp.com request_id=4c63d70d-f081-44a5-b4fe-f0992116ba79 fwd="108.28.184.177" dyno= connect= service= status=503 bytes= protocol=https
2017-11-26T15:21:36.954063+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=<my app name>.herokuapp.com request_id=e42d6293-512f-4ea1-ba35-403f44e4fd9a fwd="108.28.184.177" dyno= connect= service= status=503 bytes= protocol=https
I've looked online and added favicon.ico in my public folder. Nothing changes. I've had this problem before with my previous app and I ran heroku restart and it works for that one, but doesn't for this one.

Heroku app is getting crashed

I recently learned node.js and wanted to deploy my project, which I did on Heroku. However, Heroku is giving me the error messages copied below. Though I have logged the error, I am still not able to figure out the solution.
Here are the logs:
2016-04-13T14:24:17.248681+00:00 heroku[web.1]: Process exited with status 1
2016-04-13T14:24:17.256460+00:00 heroku[web.1]: State changed from starting to c
rashed
2016-04-13T14:24:30.863162+00:00 heroku[router]: at=error code=H10 desc="App cra
shed" method=GET path="/" host=rather-website.herokuapp.com request_id=770f4364-
859f-453a-a09c-7f23ddaf6eca fwd="103.248.93.93" dyno= connect= service= status=5
03 bytes=
2016-04-13T14:24:31.537783+00:00 heroku[router]: at=error code=H10 desc="App cra
shed" method=GET path="/" host=rather-website.herokuapp.com request_id=16af5073-
7bb2-431e-bc08-b2fb6773eab8 fwd="103.248.93.93" dyno= connect= service= status=5
03 bytes=
2016-04-13T14:27:59.122567+00:00 heroku[router]: at=error code=H10 desc="App cra
shed" method=GET path="/" host=rather-website.herokuapp.com request_id=c6ba2f2f-
7379-41bf-afc9-550c309e7200 fwd="103.248.93.93" dyno= connect= service= status=5
03 bytes=
2016-04-13T14:29:17.354776+00:00 heroku[router]: at=error code=H10 desc="App cra
shed" method=GET path="/" host=rather-website.herokuapp.com request_id=088965d7-
ddcf-46ba-a44c-ed1486938993 fwd="103.248.93.93" dyno= connect= service= status=5
03 bytes=
2016-04-13T14:29:21.657898+00:00 heroku[router]: at=error code=H10 desc="App cra
shed" method=GET path="/" host=rather-website.herokuapp.com request_id=94d1eceb-
fa46-4795-82f6-4c369eb04fb6 fwd="103.248.93.93" dyno= connect= service= status=5
03 bytes=
2016-04-13T14:29:24.198371+00:00 heroku[router]: at=error code=H10 desc="App cra
shed" method=GET path="/" host=rather-website.herokuapp.com request_id=6ff6b6be-
e29c-4a5b-b48b-cbf4f4850ccf fwd="103.248.93.93" dyno= connect= service= status=5
03 bytes=
2016-04-13T14:29:28.987226+00:00 heroku[router]: at=error code=H10 desc="App cra
shed" method=GET path="/" host=rather-website.herokuapp.com request_id=1a1709f0-
9967-4ff0-a9d3-473e147c23e1 fwd="103.248.93.93" dyno= connect= service= status=5
03 bytes=
Here is the error:
An error occurred in the application and your page could not be served. Please try again in a few moments.
If you are the application owner, check your logs for details.
The node.js server is crashing upon HTTP GET request on route /. This isn't a platform error, but a code error (likely your index.js file). You will want to check the code for error between the lines:
app.get('/', function(req, res) {
//likely some syntax error here
}
I highly recommend running the app on your local machine using command such as: node index.js to see what part of your HTTP GET code is causing the error. The CLI will give a specific line number on where the error is being caused.
Heroku Local is also a great tool for testing your app before deploying it to heroku.

Resources