how to fix 503 error on heroku PERN stack? - javascript

This is my first attempt at building a full stack application, please help:(. This is my github repo. I'm following this tutorial, but I get a 503 error appearing in the chrome developer tools console when I'm trying to SELECT * FROM todo. I can read the information in my database table through heroku cli & dataclips but it does not work in the heroku app. This is the link to my heroku app, I think the problem is in db.js or index.js but I don't know how to diagnose the problem.
This appears in my heroku cli:
2022-08-20T03:20:29.059619+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=GET path="/getall" host=bag2.herokuapp.com request_id=0dad4a29-61b0-487a-857d-53157e5907df fwd="155.69.177.63" dyno=web.1 connect=0ms service=30000ms status=503 bytes=0 protocol=https

Related

Favicon error when checking heroku logs. App won't open

2023-02-04T23:44:59.721312+00:00 app[web.1]: Node.js v18.13.0
2023-02-04T23:44:59.863463+00:00 heroku[web.1]: Process exited with status 1
2023-02-04T23:44:59.923817+00:00 heroku[web.1]: State changed from up to crashed
2023-02-04T23:44:59.726175+00:00 heroku[router]: at=error code=H13 desc="Connection closed without response" method=GET path="/" host=ancient-fjord-54261.herokuapp.com request_id=889838b4-68b1-4f29-a43b-69a1a596ebdf fwd="75.97.100.189" dyno=web.1 connect=0ms service=28172ms status=503 bytes=0 protocol=https
2023-02-04T23:45:05.030038+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=ancient-fjord-54261.herokuapp.com request_id=44e68370-195a-4e1e-97c7-66a443516f57 fwd="75.97.100.189" dyno=web.1 connect=5001ms service= status=503 bytes= protocol=https
Here's the code in my app.js. I pushed this and the other files to Heroku. Heroku CLI updated, all packages installed. Compared my app.js to the get-started index.js and made some changes to my app.js and still getting the error and won't open.
I'm doing a course on udemy for web development and its not updated for this year, so I'm having to troubleshoot every now and then. First time on stackoverflow so I need a little bit of help.
Can anyone help me with fixing this or provide me with some links to help out with troubleshooting?

I ran into application error after i deployed Node js successfully on Heroku [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
This is my first code using node, it worked fined on locahost:3000
here is the error after I checked the log:
```2021-08-31T11:16:54.000000+00:00 app[api]: Build succeeded
2021-08-31T11:16:57.474525+00:00 heroku[web.1]: Starting process with command `npm start`
2021-08-31T11:16:59.311657+00:00 app[web.1]: npm ERR! missing script: start
2021-08-31T11:16:59.314538+00:00 app[web.1]:
2021-08-31T11:16:59.314674+00:00 app[web.1]: npm ERR! A complete log of this run can be found in:
2021-08-31T11:16:59.314721+00:00 app[web.1]: npm ERR! /app/.npm/_logs/2021-08-31T11_16_59_312Z-debug.log
2021-08-31T11:16:59.351913+00:00 heroku[web.1]: Process exited with status 1
2021-08-31T11:16:59.406151+00:00 heroku[web.1]: State changed from starting to crashed
2021-08-31T11:17:31.920808+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=web-facebock.herokuapp.com request_id=a8bc0829-78b8-4ed9-93f4-c389ee0dcb39 fwd="197.210.77.72" dyno= connect= service= status=503 bytes= protocol=https
2021-08-31T11:17:32.247223+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=web-facebock.herokuapp.com request_id=d15e7971-6164-4dec-b761-0fd33b075dc4 fwd="197.210.76.123" dyno= connect= service= status=503 bytes= protocol=https```
Your package.json needs to contain:
"scripts": {
"start": "node your-script.js"
}
Start script missing error when running npm start
this question was answered similarly with more details.

React app that runs locally crashes on Heroku: H10 "App crashed"

My React application runs fine locally, but crashes on Heroku. Here are the logs:
2020-09-02T22:40:08.920880+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=corona-charts.herokuapp.com request_id=d493717f-dd9d-4a20-ad1f-76f877acbd8d fwd="174.67.238.38" dyno= connect= service= status=503 bytes= protocol=https
2020-09-02T22:41:00.972039+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=corona-charts.herokuapp.com request_id=28651997-4ff3-43ed-810b-6059f0dfae6e fwd="17
You can find all the code for my React app here: https://github.com/SirIsaacNeutron/us-corona-charts. The Heroku link is http://corona-charts.herokuapp.com.
I added the "https://github.com/mars/create-react-app-buildpack.git" buildpack that I apparently needed to add, but the app still crashes. Here are the buildpacks I used:
the buildpacks I used
The only cause of this problem that I can think of is the charts I am using. In the past, sometimes my local app crashed if I hovered over them while starting the app, although I haven't had this problem at all on my local version for a while.
I really appreciate any help you can give me. Thank you.
When using create-react-app and deploying to
dont delete the favicon.ico and manifest.json
also in package.json above scripts insert "engines": {
"npm": "6.x",
"node": "12.x"
},
//NOTE CHECK YOUR NODE AND NPM VERSIONS BY TYPING npm -v and node -v for accurate versions//
Dont add other scripts or change the start, build scripts!
This should clear all h10 errors when deploying to heroku, if they dont i suggest you create a new directory and copy your files there and start over, this link is a great guide to deploy
https://dev.to/smithmanny/deploy-your-react-app-to-heroku-2b6f

getting a 503 error when uploading to heroku with my nodejs application

I have been struggling to get my app loaded to heroku for the past couple of days. I get over one hurdle and then meet another. Now I am getting a the following error.
Failed to load resource: the server responded with a status of 503 (Service Unavailable) /favicon.ico
On the logs I am getting these error messages.
2018-04-11T08:13:48.238214+00:00 app[web.1]: > rock-paper-scissors#1.0.0 start /app
2018-04-11T08:13:48.331598+00:00 app[web.1]: Server has started.
2018-04-11T08:13:48.238216+00:00 app[web.1]:
2018-04-11T08:13:48.238198+00:00 app[web.1]:
2018-04-11T08:14:46.646952+00:00 heroku[web.1]: State changed from starting to crashed
2018-04-11T08:14:46.571274+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2018-04-11T08:14:46.629369+00:00 heroku[web.1]: Process exited with status 137
2018-04-11T09:38:48.218885+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=brianpat-rock-paper-scissors.herokuapp.com request_id=0db40b3c-c918-4a3d-9a4d-f3a5fcf69bc8 fwd="94.174.32.117" dyno= connect= service= status=503 bytes= protocol=https
2018-04-11T09:38:48.541351+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=brianpat-rock-paper-scissors.herokuapp.com request_id=ecf56ae7-84e6-43a0-9a77-3e9f9a7f538f fwd="94.174.32.117" dyno= connect= service= status=503 bytes= protocol=https
Yesterday I was getting a Method not Allowed error and now I am not sure if it has moved on or not. Not sure if this is my end or whether this is a maintenance issue with heroku? Possibly my end. I have tried looking for the same error on Stackoverflow but they have not proved helpful. Any help would be appreciated.

Heroko application error with node js

First time using Heroko. Followed the steps and my build was successful but when I go to the URL I got an application error. I looked in the logs but I'm not really sure whats happening, below is the list of logs I had
2016-08-04T14:24:15.352519+00:00 heroku[web.1]: State changed from crashed to starting
2016-08-04T14:24:31.776384+00:00 heroku[web.1]: Starting process with command `node server.js`
2016-08-04T14:24:34.211793+00:00 app[web.1]: keyword api listening at http://[::]:8088
2016-08-04T14:25:32.328147+00:00 heroku[web.1]: Stopping process with SIGKILL
2016-08-04T14:25:32.327930+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2016-08-04T14:25:32.501167+00:00 heroku[web.1]: State changed from starting to crashed
2016-08-04T14:25:32.503024+00:00 heroku[web.1]: State changed from crashed to starting
2016-08-04T14:25:32.477573+00:00 heroku[web.1]: Process exited with status 137
2016-08-04T14:25:36.445941+00:00 heroku[web.1]: Starting process with command `node server.js`
2016-08-04T14:25:39.335482+00:00 app[web.1]: keyword api listening at http://[::]:8088
2016-08-04T14:26:37.186681+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2016-08-04T14:26:37.186681+00:00 heroku[web.1]: Stopping process with SIGKILL
2016-08-04T14:26:37.329330+00:00 heroku[web.1]: Process exited with status 137
2016-08-04T14:26:37.353704+00:00 heroku[web.1]: State changed from starting to crashed
2016-08-04T14:26:37.619772+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=shielded-temple-17247.herokuapp.com request_id=db8eb419-e950-4768-8a3f-319a84f7d4e2 fwd="2.125.30.1" dyno= connect= service= status=503 bytes=
2016-08-04T14:26:38.809203+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=shielded-temple-17247.herokuapp.com request_id=5661b532-80af-40cb-8ae3-0bf9868b5e0f fwd="2.125.30.1" dyno= connect= service= status=503 bytes=
What do you have defined in your Procfile? Right now, it appears to be something like this:
web: node server.js
The Procfile tells Heroku how to run your application. The logs you showed indicate that you are trying to run your Node server on port 8088 -- this is likely the issue.
Heroku doesn't allow you to run your server on ANY port you want -- instead, it will dynamically tell you what port to run your server on when your application starts. It does this through the usage of an environment variable named PORT.
What you need to do is modify your server.js code so that you start your server on process.env.PORT.
Here's an example (in express.js):
var express = require('express');
var app = express();
app.listen(process.env.PORT);
That will successfully start up a Node server on Heroku by automatically binding to the correct port.
Hope that helps!

Categories

Resources