HEROKU Application Err - Application error An error occurred in the application and your page could not be served - node.js

I'm looking a solution for my stupid problems.
I use Heroku to deployed my application. After I linked to github,I got this error when open my application:
Application 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
I tried to research the solution but nothing worked.
My config in app.js
port = process.env.PORT || config.__port_server,
app.listen(port)
thank you

Related

Heroku fails to host my Node.js App , I just see "Cannot Get /"

I have looked at similar questions and not been able to solve this problem with what I found. I initially followed a YouTube tutorial on how to deploy a Node.js App to Heroku. After trying and failing, I began troubleshooting and could not fix the problem.
I then followed the instructions on Heroku's website for deploying a Node.js application here: https://devcenter.heroku.com/articles/deploying-nodejs and I found I seem to have done all the steps correctly. I was just missing the node version in the package.json which I have now added.
Here is how I have connected my Node.js app:
image of Heroku application dashboard
And here is the connected Github repo: https://github.com/AmeenIzhac/food-and-flow-backend
You can see in the repo that my port is specified correctly:
const port = process.env.PORT || 4000;
I then tried running the app locally on the command line with:
heroku local web
and this worked as you can see my application running on port 5000:
App running locally on port 5000
However when I press "Open app" in Heroku, I just see this:
Heroku hosted app fails to get /
I feel like I have done everything correctly but it doesn't seem to work. Any help to get it working would be much appreciated.
You need a procfile. What is the heroku error in heroku logs --tail?

when i am reloading a nodejs and angular app hosted on heroku gives me an error

I deploy a angular and nodejs app on heroku but after reloading that deployed app it gives me error.
please help in resolving this error.
Error

Why is my basic hello world nodejs app not working on Heroku?

I got this errror:
Application 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
I tried adding various repositories that other people have built as well.
Does Heroku require certain file requirements for the app to show up?
My git repository is located here: https://github.com/nathanpuls/helloworld2
My heroku app is located here: https://wyresapp.herokuapp.com/
If you have deployed your app to Heroku as it is in the git repository, then you are missing two things.
You should assign an environment value for the port so that Heroku can use it to set the port number. It won't run the app on a user-defined port number. It should look sth like,
var port = process.env.port || 3000;
Procfile is missing. It is a simple file that instructs what kind of app you have and how it should start. In your case, it should be
web: node index.js

Heroku Deployment 404 Error with Node.js and Express.js Server

Anyone willing to help with a Heroku Deployment?
When I run my local repo the server works great but once I deploy it on Heroku I get a 404 Error.
I am using Node.js Express Server.
The server console is suppose to generate: Listening on port 5000!
The error I get instead is: {"error":{"message":"Error not found in app.js"}}
Git Hub Repo
https://github.com/instant-help/instant-help-backend
Deployed Repo
https://thawing-river-10076.herokuapp.com/

Deploying nodeJS to Heroku internal error

I am trying to upload NodeJS app to Heroku. Everything installs fine and when I run
heroku local
Then everything works as expected on a local host. But when I run
heroku ps:scale web=1
heroku open
Browser opens, and it is loading the page for like 2-3 minutes, or even more and then I receive Application error. I am new to web development so that any ideas will be helpful. Thanks!
Thanks to gnerkus I managed to figure that out.
In logs I found next error:
heroku Error R10 (Boot timeout) -> Web process failed to bind to $PORT
Heroku dynamically assigns port to app and I was doing it manually:
app.listen(4000, function () {
Instead i just need listen like this:
.listen(process.env.PORT || 5000)
Answer was here:
Heroku + node.js error (Web process failed to bind to $PORT within 60 seconds of launch)

Resources