Nodejs app working on localhost but crashes on heroku - node.js

My nodejs app is working on localhost but when deployed with heroku, it crashes showing me one new module or the other that it cannot find. What do I do?

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?

Heroku only works if my local host server is working

my heroku deployment only works when my local host is running.
I havent checked if it works on other computers - but it doesnt work on my phone for example.
So far I was only able to run it on my PC - it works on both localhost and the site deployed to Heroku (link here to it).
When I had the server down ( node index.js wasnt running ), neither heroku nor the localhost servers were working.
Then when I turned it back on - both localhost and heroku serves started working. 👍
What could be causing this ?

Cant connect azureweb app to node server, resulting in net::ERR_CONNECTION_REFUSED

I am using node.js and react and have deployed to the azure app service,
the startup command is pm2 serve /home/site/wwwroot --no-daemon --spa which works
However when I visit the website and visit a page that needs to load images from a database or perform any http requests, the app can't connect to the node.js server and I get the error:
https://boobah.azurewebsites.net:8080/requests/therapists net::ERR_CONNECTION_TIMED_OUT
The call I make in my code to load the data to the page is this:
await axios.get('https://boobah.azurewebsites.net:8080/requests/therapists')
which works locally just by changing the domain to localhost and on port 3000.
Can anyone please help me for why this is not loading any data to the deployed azure app ?
Thanks you

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

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/

Resources