Node server runs perfectly on localhost but not at all on Heroku - node.js

I've got a server which I've developed on localhost, and I thought that Heroku would be a good stepping stone to going live. Unfortunately, I can't get it to work.
More specifically, I can get Heroku to build well enough, but it crashes as soon as I try to access my website.
Heroku logs are as follows:
2019-06-30T18:34:04.000000+00:00 app[api]: Build started by user tomdothosker#gmail.com
2019-06-30T18:34:24.381150+00:00 app[api]: Deploy 7f8cce5d by user tomdothosker#gmail.com
2019-06-30T18:34:24.381150+00:00 app[api]: Release v17 created by user tomdothosker#gmail.com
2019-06-30T18:34:25.000000+00:00 app[api]: Build succeeded
2019-06-30T18:34:25.695607+00:00 heroku[web.1]: Restarting
2019-06-30T18:34:26.034203+00:00 heroku[web.1]: State changed from up to starting
2019-06-30T18:34:26.966179+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2019-06-30T18:34:27.034914+00:00 heroku[web.1]: Process exited with status 143
2019-06-30T18:34:29.568812+00:00 heroku[web.1]: Starting process with command `npm start`
2019-06-30T18:34:32.418305+00:00 app[web.1]:
2019-06-30T18:34:32.418320+00:00 app[web.1]: > cyprus#1.0.0 start /app
2019-06-30T18:34:32.418324+00:00 app[web.1]: > node server.js
2019-06-30T18:34:32.418325+00:00 app[web.1]:
2019-06-30T18:34:33.279874+00:00 heroku[web.1]: State changed from starting to up
2019-06-30T18:34:32.889328+00:00 app[web.1]: Server running at https://localhost:59348/
2019-06-30T18:34:34.982611+00:00 heroku[router]: at=error code=H13 desc="Connection closed without response" method=GET path="/" host=kingdom-of-cyprus.herokuapp.com request_id=5f8137a5-c584-4b40-8089-58ba67f88de3 fwd="165.120.137.21" dyno=web.1 connect=0ms service=1ms status=503 bytes=0 protocol=https
2019-06-30T18:34:35.256350+00:00 heroku[router]: at=error code=H13 desc="Connection closed without response" method=GET path="/favicon.ico" host=kingdom-of-cyprus.herokuapp.com request_id=6223ae91-d44d-4762-a9d9-971f923a5cc8 fwd="165.120.137.21" dyno=web.1 connect=2ms service=3ms status=503 bytes=0 protocol=https
From what I can tell from the logs, the site starts as it's supposed to, then crashes immediately. Which I know makes no sense. Any ideas what's going on here?
If it helps, server.js can be found here. The interesting stuff starts at around line 266.

Related

Heroku, Stopping all processes with SIGTERM, Process exited with status 143

My backend was hosted on heroku for more than a month and was working fine. Now, today when i opened my website it shows this error in heroku logs.
heroku logs
`` 2022-11-26T13:59:37.770793+00:00 heroku[web.1]: Unidling 2022-11-26T13:59:37.773849+00:00
` 2022-11-26T13:59:37.770793+00:00 heroku[web.1]: Unidling 2022-11-26T13:59:37.773849+00:00 heroku[web.1]: State changed from down to starting 2022-11-26T13:`your text`59:40.671794+00:00 heroku[web.1]: Starting process with command `npm start` `2022-11-26T13:59:43.453482+00:00 app\[web.1\]:\`
2022-11-26T13:59:43.453508+00:00 app\[web.1\]: \> server#1.0.0 start
2022-11-26T13:59:43.453508+00:00 app\[web.1\]: \> node index.js
2022-11-26T13:59:43.453509+00:00 app\[web.1\]:
2022-11-26T13:59:43.936570+00:00 app\[web.1\]: Server started successfully on port 28406
2022-11-26T13:59:44.394629+00:00 heroku\[web.1\]: State changed from starting to up
2022-11-26T13:59:45.969634+00:00 app\[web.1\]: MongoDB Connected: ac-rbrrtx1-shard-00-02.hnnmtja.mongodb.net
2022-11-26T13:59:47.331529+00:00 heroku\[router\]: at=info method=GET path="/todos" host=to-do.herokuapp.com request_id=498c9348-ac27-4d03-98c5-ed9650e5b6d3 fwd="74.125.215.152" dyno=web.1 connect=0ms service=2501ms status=200 bytes=770 protocol=https
2022-11-26T14:35:38.862987+00:00 heroku\[web.1\]: Idling
2022-11-26T14:35:38.864646+00:00 heroku\[web.1\]: State changed from up to down
2022-11-26T14:35:39.633081+00:00 heroku\[web.1\]: Stopping all processes with SIGTERM
2022-11-26T14:35:39.834323+00:00 heroku\[web.1\]: Process exited with status 143
2022-12-02T12:31:11.037127+00:00 app\[api\]: Scaled to web#0:Eco by user api-maintenance#heroku.com
2022-12-08T18:34:07.067959+00:00 heroku\[router\]: at=error code=H14 desc="No web processes running" method=GET path="/robots.txt" host=to-do.herokuapp.com request_id=c7c564c9-6334-4140-bf27-6b0750093c26 fwd="5.255.253.147" dyno= connect= service= status=503 bytes= protocol=https\`\`
`
First, I would like to confirm whether you are using free plan of Heroku or not. Because Heroku stopped its free plan starting from November-26-2022.
For further information:
https://make.wordpress.org/plugins/2022/09/13/heroku-free-tier-being-retired/
If you have a paid version then it's a problem associated with dynos as the error is giving code H14 (last line). This is most likely the result of scaling your web dynos down to 0 dynos. Scale up your dynos to fix it.
For more information visit Heroku error codes:
Heroku error codes

heroku Nodejs app not unidling after request

I have a nodejs app that runs on heroku and works fine until it idles(because im on the free plan). After it idles when I try to wake the app up it logs: "App Crashed". This issue is fixed by restarting the app using the cli: heroku restart. However this is not a working solution for the end user. I am using deploy through github and webpack, which I mention because those are the only differences from my other heroku apps which unidle just fine. Is there a way to have the request unidle the app?
Here are the logs:
2022-06-30T17:13:21.294071+00:00 heroku[web.1]: Idling
2022-06-30T17:13:21.308560+00:00 heroku[web.1]: State changed from up to down
2022-06-30T17:13:22.877570+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2022-06-30T17:13:23.113129+00:00 heroku[web.1]: Process exited with status 143
2022-07-02T17:42:20.649030+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=fwpsg.herokuapp.com request_id=1f058e06-12e9-4210-a9bc-097ebdce811d fwd="73.247.37.113"
dyno= connect= service= status=503 bytes= protocol=https

Running URL after Heroku Deployment displays application error

I've created the project on GoormIDE and am trying to deploy it using Heroku, however it is giving error as
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've tried running the application from Goorm itself and it is running without any error.
The Heroku logs say that
W 2020-06-04T13:40:13.026765+00:00 app[web.1]:
Server running at port 3000 2020-06-04T13:40:13.200053+00:00
app[web.1]: Connected 2020-06-04T13:41:09.692255+00:00 heroku[web.1]:
Error R10 (Boot timeout) -> Web process failed to bind to $PORT within
60 seconds of launch 2020-06-04T13:41:09.717907+00:00 heroku[web.1]:
Stopping process with SIGKILL 2020-06-04T13:41:09.833400+00:00
heroku[web.1]: Process exited with status 137
2020-06-04T13:41:09.879805+00:00 heroku[web.1]: State changed from
starting to crashed 2020-06-04T13:41:11.348533+00:00 heroku[router]:
at=error code=H10 desc="App crashed" method=GET path="/"
host=immense-harbor-74512.herokuapp.com
request_id=2bfa2066-edf0-4c28-bee0-b84522cae634 fwd= "27.60.111.103"
dyno= connect= service= status=503 bytes= protocol=httpsthen,
What is the problem and how to fix it
Procfile
web:guinicorn python app.py

Node.js app crashes on deploying to Heroku

I have a Node.js app which runs well locally, but when I deploy it on Heroku, it doesn't run.
I have deployed it from my Github repository.
Can some one try deploying the app from my repo and tell me what the cause of the problem is?
Git repository link-MyGallary
Logs:
2017-09-03T12:22:17.683830+00:00 heroku[web.1]: State changed from crashed to starting
2017-09-03T12:22:18.878329+00:00 heroku[web.1]: Starting process with command `: node run start`
2017-09-03T12:22:20.670131+00:00 heroku[web.1]: Process exited with status 0
2017-09-03T12:22:20.682348+00:00 heroku[web.1]: State changed from starting to crashed
2017-09-03T12:24:19.679927+00:00 heroku[web.1]: State changed from crashed to starting
2017-09-03T12:24:20.918678+00:00 heroku[web.1]: Starting process with command `: node run start`
2017-09-03T12:24:23.583966+00:00 heroku[web.1]: Process exited with status 0
2017-09-03T12:24:23.595826+00:00 heroku[web.1]: State changed from starting to crashed
Disconnected from log stream. There may be events happening that you do not see here! Attempting to reconnect...
2017-09-03T12:24:19.679927+00:00 heroku[web.1]: State changed from crashed to starting
2017-09-03T12:24:20.918678+00:00 heroku[web.1]: Starting process with command `: node run start`
2017-09-03T12:24:23.583966+00:00 heroku[web.1]: Process exited with status 0
2017-09-03T12:24:23.595826+00:00 heroku[web.1]: State changed from starting to crashed
2017-09-03T12:33:34.507063+00:00 heroku[web.1]: Process exited with status 0
2017-09-03T12:39:41.420058+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=mygallary.herokuapp.com request_id=10a1d1e0-5b5f-45f7-b65c-efdb8d6e9b3f fwd="106.51.243.120" dyno= connect= service= status=503 bytes= protocol=https
2017-09-03T12:39:42.764416+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=mygallary.herokuapp.com request_id=5ff09ee3-26d7-44a6-8556-f4e5d19a0ce5 fwd="106.51.243.120" dyno= connect= service= status=503 bytes= protocol=https
Thanks in advance.
Try typing "heroku logs" on your terminal and share the logs here.
EDIT:
It's "npm run start" or "node startfile.js" Ex: "node app.js"
(can type only app without .js)

Strongloop deploy to Heroku doesn't work

Followed all the steps can't figure out how to get this done
Keep getting
bash: slc: command not found
Procfile
web: slc run
2015-03-26T02:43:13.998982+00:00 heroku[web.1]: State changed from
crashed to starting 2015-03-26T02:43:18.757072+00:00 heroku[web.1]:
Starting process with command slc run
2015-03-26T02:43:20.054559+00:00 app[web.1]: Detected 512 MB available
memory, 512 MB limit per process (WEB_MEMORY)
2015-03-26T02:43:20.054946+00:00 app[web.1]: bash: slc: command not
found 2015-03-26T02:43:20.054584+00:00 app[web.1]: Recommending
WEB_CONCURRENCY=1 2015-03-26T02:43:20.786104+00:00 heroku[web.1]:
Process exited with status 127 2015-03-26T02:43:20.807164+00:00
heroku[web.1]: State changed from starting to crashed
2015-03-26T02:44:16.130969+00:00 heroku[router]: at=error code=H10
desc="App crashed" method=GET path="/"
host=salty-journey-3310.herokuapp.com
request_id=48c6c94a-22d7-4c5e-9a6c-2384c5d37cdc fwd="216.165.95.72"
dyno= connect= service= status=503 bytes=
2015-03-26T02:44:50.716616+00:00 heroku[router]: at=error code=H10
desc="App crashed" method=GET path="/worker-signin"
host=salty-journey-3310.herokuapp.com
request_id=e12abfd7-4d0a-4869-93b3-5139f8d4e34c fwd="216.165.95.72"
dyno= connect= service= status=503 bytes=
2015-03-26T02:46:07.463936+00:00 heroku[router]: at=error code=H10
desc="App crashed" method=GET path="/client-signup"
host=salty-journey-3310.herokuapp.com
request_id=be1015fc-a9b4-4b46-b858-b59ed1702d60 fwd="216.165.95.72"
dyno= connect= service= status=503 bytes=
2015-03-26T02:48:38.323367+00:00 heroku[web.1]: State changed from
crashed to starting 2015-03-26T02:48:44.211997+00:00 heroku[web.1]:
Starting process with command slc run
2015-03-26T02:48:46.005432+00:00 app[web.1]: Detected 512 MB available
memory, 512 MB limit per process (WEB_MEMORY)
2015-03-26T02:48:46.005458+00:00 app[web.1]: Recommending
WEB_CONCURRENCY=1 2015-03-26T02:48:46.024208+00:00 app[web.1]: bash:
slc: command not found 2015-03-26T02:48:46.871183+00:00 heroku[web.1]:
Process exited with status 127 2015-03-26T02:48:46.882329+00:00
heroku[web.1]: State changed from starting to crashed
2015-03-26T02:55:07.351372+00:00 heroku[api]: Add strongloop:test
add-on by tejas.vj.bhatt#gmail.com 2015-03-26T02:55:07.351372+00:00
heroku[api]: Release v8 created by tejas.vj.bhatt#gmail.com
2015-03-26T02:55:07.460254+00:00 heroku[web.1]: State changed from
crashed to starting 2015-03-26T02:55:12.262442+00:00 heroku[web.1]:
Starting process with command slc run
2015-03-26T02:55:13.558424+00:00 app[web.1]: Detected 512 MB available
memory, 512 MB limit per process (WEB_MEMORY)
2015-03-26T02:55:13.558444+00:00 app[web.1]: Recommending
WEB_CONCURRENCY=1 2015-03-26T02:55:13.558648+00:00 app[web.1]: bash:
slc: command not found 2015-03-26T02:55:14.284209+00:00
heroku[web.1]: State changed from starting to crashed
2015-03-26T02:55:14.278656+00:00 heroku[web.1]: Process exited with
status 127 2015-03-26T02:57:35.737008+00:00 heroku[api]: Deploy
b6cac37 by tejas.vj.bhatt#gmail.com 2015-03-26T02:57:35.737008+00:00
heroku[api]: Release v9 created by tejas.vj.bhatt#gmail.com
2015-03-26T02:57:35.974640+00:00 heroku[web.1]: State changed from
crashed to starting 2015-03-26T02:57:41.438704+00:00 heroku[web.1]:
Starting process with command slc run
2015-03-26T02:57:42.881097+00:00 app[web.1]: Detected 512 MB available
memory, 512 MB limit per process (WEB_MEMORY)
2015-03-26T02:57:42.881117+00:00 app[web.1]: Recommending
WEB_CONCURRENCY=1 2015-03-26T02:57:42.881843+00:00 app[web.1]: bash:
slc: command not found 2015-03-26T02:57:43.606052+00:00 heroku[web.1]:
Process exited with status 127 2015-03-26T02:57:43.633805+00:00
heroku[web.1]: State changed from starting to crashed
2015-03-26T02:58:01.953397+00:00 heroku[router]: at=error code=H10
desc="App crashed" method=GET path="/"
host=salty-journey-3310.herokuapp.com
request_id=5b405b2b-3e81-4140-8ed6-205868383854 fwd="216.165.95.72"
dyno= connect= service= status=503 bytes=
I believe your best bet is to remove the buildpack and edit your Procfile to be web: node ..
Why? Strongloop-specific tooling is no longer being maintained since being purchased by IBM. Loopback itself is being maintained, and in fact the loopback-cli project specifically mentions that it "supersedes" strongloop's "older slc tool."
Note that loopback-cli should not be necessary to run the heroku server.
I think I saw this error when I didn't create the app with the strongloop buildpack. I'm assuming you're following the strongloop heroku article, did you get all the way through it?
I missed this step:
heroku apps:create --buildpack https://github.com/strongloop/strongloop-buildpacks.git

Resources