Heroku Error H14 (No web processes running) - node.js

Pretty sure some people encountered this problem before.
Followed all the instructions to setup node and npm. When pushing to heroku there were no errors. But when I open the app, it shows "Application Error"
heroku ps
returns
Process State Command
------- --------- ------------
main.1 up for 1m node main.js
while
heroku logs
returns
Error H14 (No web processes running) -> GET mewtwo.herokuapp.com/ dyno= queue= wait= service= status=503 bytes=
I tried restarting the app with heroku restart but still get the same error. Google around and there were no other solution other than heroku restart. Anyone tried other methods ?

I had the same problem, but for me it was because I needed to run heroku ps:scale web=1

The name of your web process must be web, and this is the process that Heroku will always scale to '1' on initial deploy.
Other services in the Procfile can be called what you want, but you need to scale them initially (so you can have dev only processes in there if you want).
More information here: http://neilmiddleton.com/the-procfile-is-your-friend/
(the cached version: https://web.archive.org/web/20130926005616/http://www.neilmiddleton.com/the-procfile-is-your-friend)

I guess my problem was this, i had a python script in my node application which led heroku to believe that it is a python app, also i did not add a procfile since i expected the build bots to automatically detect that its a node app, so after setting up the procfile , then specifying the node and npm versions inside engines key in package.json, and changing the buildpack type to heroku/node, i got my app running.

Full disclosure, I solved this problem by turning it on.
Heroku Application Overview tab > click Configure Dyno > click the pencil icon > click toggle switch to On position > click confirm

Related

Heroku nodejs app gets 503 error when connecting to heroku-redis

I have a nodejs API app running on heroku and i get a service unavailable 503 error when this app tries to connect to heroku-redis or another redis server on redislabs.com (I tried both redis servers to see if it'd make a difference). I have a free heroku dev account being used for this nodejs API app and the heroku-redis add-on. Perhaps I need a static IP for the free heroku app to connect to heroku-redis? Not sure.
This is what i see when i look at my app's logs on heroku:
2022-02-05T18:30:24.003600+00:00 app[web.1]: > start
2022-02-05T18:30:24.003601+00:00 app[web.1]: > node app.js
2022-02-05T18:30:24.003601+00:00 app[web.1]:
2022-02-05T18:30:26.254765+00:00 heroku[web.1]: State changed from starting to up
2022-02-05T18:31:03.724181+00:00 app[web.1]: Starting RXNsetup app
2022-02-05T18:31:03.725096+00:00 app[web.1]: Start Redis connection
2022-02-05T18:31:33.716830+00:00 heroku[router]: at=error code=H12 desc="Request timeout" method=POST path="/run" host=rxnsetup.herokuapp.com request_id=c983d257-8773-4fff-a4d1-4b74341366b6 fwd="190.111.231.94" dyno=web.1 connect=0ms service=30176ms status=503 bytes=0 protocol=https
2022-02-05T18:30:00.000000+00:00 app[heroku-redis]: source=HEROKU_REDIS_CRIMSON addon=redis-symmetrical-62029 sample#active-connections=1 sample#load-avg-1m=1.105 sample#load-avg-5m=0.96 sample#load-avg-15m=0.6 sample#read-iops=0 sample#write-iops=0 sample#memory-total=15619136kB sample#memory-free=10625808kB sample#memory-cached=2390936kB sample#memory-redis=333744bytes sample#hit-rate=1 sample#evicted-keys=0
The first log statement above is in reference to another nodejs app that makes a POST HTTP request to the nodejs API app being run on heroku. I am able to connect to my redis server fine when i hit this same nodejs API app locally, but for some reason I get a 503 error when the same nodejs app runs in heroku. I have configured all of the same environment variables in heroku like i've done locally. I've been researching for awhile but am stuck with what could be causing this 503 error.
Update:
The root issue looked to be first that I had multiple instances of heroku-redis running, so I needed to promote one instance to be the primary one. Then another issue was that the REDIS_URL environment variable was being evaluated to undefined at runtime which was causing the 503 service errors I was getting.
I suspect you're looking at a stale connection string.
HEROKU_REDIS_<color> variables are normally only used if you have multiple deployments:
Heroku creates the REDIS_URL config var to store the location of the primary instance. In single-instance setups, your new instance is assigned a REDIS_URL. In cases where REDIS_URL exists, your instance is assigned a HEROKU_REDIS_<color> URL instead.
Normally, even if you have multiple instances, you would still connect to REDIS_URL, not HEROKU_REDIS_<color>. You can promote a HEROKU_REDIS_<color> URL to REDIS_URL by running
heroku redis:promote HEROKU_REDIS_<color>
Update your application to use REDIS_URL, review your addons to see if you have multiple Redis services provisioned, and decide which one(s) to keep. Then promote its variable to REDIS_URL as above.

error code=H14 desc="No web processes running" after trying to deploy Puppeteer app Heroku

I am trying to deploy a simple app to Heroku that performs Web Scraping using Puppeteer.
Since there's a problem using Puppeteer in Heroku, I needed to define a buildpack to support Puppeteer, following these articles:
Puppeteer unable to run on heroku
https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md#running-puppeteer-on-heroku
https://github.com/jontewks/puppeteer-heroku-buildpack
Following these steps gave me the following error:
code=H14 desc="No web processes running"
after a bit of searching online, I found the following articles:
H14 error in heroku - "no web processes running"
saying that I have no web dynos running, and I have tried to set some up using the suggested command:
heroku ps:scale web=1
But that just gave me this error:
Scaling dynos... ! ▸ Couldn't find that process type (web).
I am running a Node.js app, using Yarn as the package manager.
What should I do?
I'll describe the process I've been through to solve this problem, which required a good amount of time.
First, I made sure that the problem is not caused by using Yarn instead of npm, according to Heroku documentation, if the root folder of your app contains yarn.lock file, then it automatically should use Yarn to build the app. But then they also say that you need to add to your package.json file a description of the version of Yarn your using, so I did:
"engines": {
"yarn": "1.x"
},
That was to make sure the problem is not yarn. which it wasn't.
Next, I have tried to understand exactly what the problem is with the web dynos, after a lot of searching I came across this:
https://help.heroku.com/W23OAFGK/why-am-i-seeing-couldn-t-find-that-process-type-when-trying-to-scale-dynos
This article also suggested using the heroku buildpacks:clear as the previous suggestion in the StackOverflow issue, but it said one more thing, super important:
Remove the existing Buildpacks...and add them again in the right order
What order? well... apparently that when I followed the previous StackOverflow issue, I have removed all the Buildpacks that came with the Heroku setup, including a very important one the heroku/nodejs build pack.
So I figured I have to re-add it to my Buildpack list. I also figured that if that is the default Buildpack that should be number one in the list, and the Buildpack for puppeteer should come after that (can be done by using the --index flag).
Finally, I solved the problems by running the following commands:
$ heroku buildpacks:clear
$ heroku buildpacks:add heroku/nodejs
$ heroku buildpacks:add --index=2 jontewks/puppeteer
$ git commit --allow-empty -m "Adjust buildpacks on Heroku"
$ git push heroku master
Running $ heroku buildpacks to confirm, returned the following:
=== workday-jobs Buildpack URLs
1. heroku/nodejs
2. jontewks/puppeteer
Now I know I have the necessary Buildpacks, in the right order, and it works!

'heroku local' cannot find module 'load-foreman-procfile'

I'm trying to run Heroku applications locally via 'heroku local,' but a missing module error is occurring in the Heroku CLI. Is this a Heroku bug that just needs to be reported or is there something wrong with how things have been setup on my machine (mac)? Any suggestions are appreciated.
In order to ensure my application isn't the problem, I've been debugging this issue with the node application Heroku provides in its getting started guides. Meaning, it already has a Procfile that can be run using default settings.
Things I've tried:
Re-install node modules for both application and CLI
Re-install the Heroku CLI
Here's the error:
node-js-getting-started [master] :> heroku local
Error: Cannot find module '../../load-foreman-procfile'
at Object.<anonymous> (/usr/local/Cellar/heroku/7.26.1/libexec/node_modules/#heroku-cli/plugin-local/lib/commands/local/index.js:5:18)
The file for the route above requires a 'load-foreman-procfile' like so:
const Procfile = require('../../load-foreman-procfile');
That require path doesn't lead to a to file by that name. In fact, this is the only reference to 'load-foreman-procfile' I can find in '/usr/local/Cellar/heroku/7.26.1'.
Rather than the error code above, I would expect heroku local to yield a running local server started via my Procfile.
I got the same error running heroku-cli v7.26.0. I switched to their edge channel (currently v7.26.2) and heroku local worked for me after that.
like #sophon mentioned - updating from v7.26.0 to v7.26.2 solved this for me. heroku update on mac did the trick.

ERROR: Procfile does not exist, and problems starting web processes

So, I'm currently following this tutorial: https://devcenter.heroku.com/articles/nodejs to start a simple Node.js app. I've got to the part where foreman is used to run the app locally (under Declaring process types with Procfile), and I'm getting an error telling me that the Procfile does not exist. My Procfile is in the same directory as my code, etc. All of the steps up till now have been fine. I skipped past this part in the tutorial to try and run the application on Heroku, but this line heroku ps:scale web=1 under Visit your application tells me that there is "No such type as web"... I'm using Windows to develop my app. Any help would be much appreciated. :-)
EDIT: web: node web.js is the contents of the Procfile, and I'm following the tutorial so I assume it's being committed... could you check the tutorial please and tell me if it is?
I had also received the Procfile does not exist error. The issue with mine was that I had left the '.txt' extension on the file. Once I removed the file extension and ran the foreman start it worked perfectly, hope this help =)

Weinre on heroku

I am trying to set up Weinre on heroku but I am having some issues.
I manage to build the app, simply by using a package.json with weinre npm dependency and a Procfile that looks like the following
web: node_modules/weinre/weinre --httpPort $PORT
At first everything seems to work, the client shows up the UI, the JS file loads fine, but the debug does not work and no client ever shows up at the server side.
While looking at the logs, I realized that I keep getting 404 errors for every request that contains /ws/target/* or /ws/client/*
2012-05-31T22:37:53+00:00 heroku[router]: GET xxxx.herokuapp.com/target/target-script.js dyno=web.1 queue=0 wait=0ms service=10ms status=200 bytes=190900
2012-05-31T22:37:36+00:00 heroku[router]: GET xxxx.herokuapp.com/ws/target/t-3 dyno=web.1 queue=0 wait=0ms service=3ms status=404 bytes=9
2012-05-31T22:36:39+00:00 heroku[router]: POST xxxx.herokuapp.com/ws/client/c-1 dyno=web.1 queue=0 wait=0ms service=40ms status=404 bytes=9
This setup works localy with no problem.
I also tried the Procilfe with --boundHost 0.0.0.0 and got the same error. when I use my heroku app domain/subdomain as the host I got weinre: error running server: Error: listen EADDRNOTAVAIL error
If needed, you can checkout the source at the github repo
https://github.com/felipesabino/weinre-heroku
EDIT:
It is possible that it is related to WebSockets not being supported on Heroku:
https://devcenter.heroku.com/articles/http-routing#websockets
The weirdest thing is that the same issue happens with PhoneGap's weinre debug page as well
http://debug.phonegap.com/
Does anybody know how to solve this?
I have weinre running on Heroku at the moment but I remember that when I was trying to get it working it was a real nightmare.
This was using the 2.0.0-pre-H0WVARLU-incubating of weinre so it may be a bit different but what I had to do was:
Modify weinre itself, I had to tell weinre to bind to all hosts, I modified the cli.coffee file and I set the boundHost to -all- as the default
I commended out the if remoteAddress check in channelManager.coffee since the address you come in from is remapped through the proxy and was never matching
Turn on verbose debugging, while you don't actually need this to run it made it a lot easier to trace where errors are happening (and why the requests weren't routing)
My Procfile ended up being very simple as I tried to use weinre as "native" as possible (note the repo contains only weinre, it's not a module like you're doing):
web: node weinre
I left any port changes to be handled by process.env.PORT, not passed in from the Procfile
Basically what I found was that weinre really isn't designed to work behind a proxy!
See this pull request https://github.com/apache/incubator-cordova-weinre/pull/10
Note that no other modifications are needed, Procfile can set the options (like it should) and Weinre is properly used as node module.
package.json (that contains the fix)
"dependencies" : {
"weinre": "https://github.com/downloads/AppGyver/incubator-cordova-weinre/apache-cordova-weinre-2.0.0-pre-H77LBWIW-incubating-bin.tar.gz"
},
Procfile
web: node_modules/weinre/weinre --httpPort $PORT --boundHost -all- --debug true --verbose true
Modify weinre itself, I had to tell weinre to bind to all hosts, I modified the cli.coffee file and I set the boundHost to -all- as the default
I commended out the if remoteAddress check in channelManager.coffee since the address you come in from is remapped through the proxy and was never matching
this two Hints helped a lot on appfog, too
Also you need to
rename weinre to app.js
require local coffeescript
assign cli to a variable and execute run direct
extend cli.coffee - > Port with process.env.PORT

Resources