Node app in heroku runs locally but I cannot scale dynos - heroku

I'm trying to run a node app in heroku. Foreman works to run it locally, and it pushes to git without any errors. However, when I run heroku ps:scale web=1, it says there is no such type as web. My Procfile is just this line: web: node server.js, which I think should work to set the web type.
Does anyone know why this could be going wrong? Your help would be appreciated!
Here's a copy of the terminal...
jmm-2:supportEmail jamesmatheson$ foreman start
14:35:07 web.1 | started with pid 36298
14:35:08 web.1 | app is running on /removed port/
14:35:08 web.1 | database open
^CSIGINT received
14:35:09 system | sending SIGTERM to all processes
SIGTERM received
14:35:09 web.1 | exited with code 1
jmm-2:supportEmail jamesmatheson$ heroku ps:scale web=1
Scaling web dynos... failed
! No such type as web.

Specity --app APP_NAME (As given in My Apps in Heroku). Just answered same questions here:
Heroku Web Dyno failing

Related

Foreman exiting with code 1

I'm a complete heroku and nodejs newbie. I just followed a tutorial to get a GroupMe bot running locally with heroku. After running the command foreman start, I receive the following:
18:10:00 web.1 | started with pid 24985
18:10:00 web.1 | exited with code 1
18:10:00 system | sending SIGTERM to all processes
The procfile reads:
web: node index.js
How do I prevent exiting with code 1 above?
You might see that message if you don't have node installed on your local machine. You can check by typing
node --version
The Getting Started with Node.js on Heroku tutorial at https://devcenter.heroku.com/articles/getting-started-with-nodejs#introduction might be helpful. It walks you through deploying a Node.js app step-by-step.
Try running the program manually:
node index.js
This will show you the actual errors you have.

Heroku Boot Timeout (Error R10)

Every time I launch my app it cannot get past the 60 second point without:
2012-05-06T22:41:11+00:00 heroku[web.1]: Stopping process with SIGKILL
2012-05-06T22:41:11+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2012-05-06T22:41:11+00:00 heroku[web.1]: Process exited with status 137
2012-05-06T22:41:12+00:00 heroku[web.1]: State changed from starting to crashed
Here is my Procfile:
web: bundle exec thin start -p $PORT
Any responses will be thoroughly appreciated.
If your app does take longer than 60 seconds for "good" reasons, you can work around the 60s boot time limit with https://github.com/dblock/heroku-forward.
The solution was that I had forgotten to include the -p $PORT in my Procfile line.
in Procfile change:
web: bundle exec thin start
to
web: bundle exec thin start -p $PORT
That fixed it for me.
Heroku's boot timeout bit me too. I read several blog posts about how to get around it and ended up automating some of the solutions into a gem.
To reduce the startup time on deploy, you can trim the gems loaded at boot time (this doesn't mean you have to trim them from the app, just boot time).
gem_bench evaluates which gems are likely to not be needed at boot time.
I have an app with about 250 gems and was able to add :require => false to about 60 of them, with dramatic effects.
https://github.com/acquaintable/gem_bench
Disclaimer: I am the author of this open source ruby gem. I wrote the gem to aid myself in solving this exact problem: the 60 second timeout on Heroku.
Hi i was facing the same issue.I have resolved this issue by increase the timeout in /config/unicorn.rb
change timeout 15 to timeout 20 in /config/unicorn.rb
In my case using nodejs I solved this adding a Procfile file with content:
worker: node index.js and push it to heroku.
After that make sure to disable the check "web npm start" and turn on the check "worker node index.js" just like the image attached below
herokuResourcesConfig
I was having the same error when deploying my Node app on Heroku.
I got it solved by adding a Procfile.
web: node app.js
It tells Heroku how to start the application.
The error is because of Heroku is not able to configure on which PORT to run the application.
It can be solved by specifying the PORT for Heroku, ie: in app.js
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
console.log(`App is running on port ${ PORT }`);
});
Error R10 (Boot timeout)
is this hidden section of heroku allows you to increase the deployment time.
https://tools.heroku.support/limits/boot_timeout
I got this error because Heroku didn't have access to the Mongo Atlas database. You need to change this in the database settings
have the same issue, solved by creating file with proxy server
https://www.npmjs.com/package/http-proxy#setup-a-basic-stand-alone-proxy-server
proxy.js:
httpProxy.createProxyServer({
target, // target that can't cant be exposed, e.g. localhost:4000
changeOrigin: true,
}).listen(process.env.PORT); // port from heroku runtime
then
node server/proxy.js

How can I tell how many worker dynos I'm using on Heroku?

I'm using HireFireApp to autoscale my web and worker dynos on Heroku. However, when I navigate to the Resque app on my application it says
"0 of 46 Workers Working"
Does this mean that I'm using 46 worker dynos???
Update:
Running heroku ps shows:
web.1 up for 21m bundle exec thin start -p $PORT
worker.1 starting for 1s bundle exec rake resque:work QUEUE..
From the command line in your heroku app have a look at the output of
heroku ps
that will show you how many workers you are running.

Do you get charged when you put a Heroku app in maintenance mode?

I have an app, with some services etc on Heroku.
When i put it in maintenance mode, do I still get charged for it?
Yes, you would get charged for any running processes that you have running at the normal rate. Maintenance mode is simply a message to the router asking it to not route requests into your application.
$ heroku ps
Process State Command
------- ------------ ------------------------------------
web.1 running for 25h bundle exec unicorn -p $PORT -c ./..
$ heroku maintenance:on
Maintenance mode enabled.
$ heroku ps
Process State Command
------- ------------ ------------------------------------
web.1 running for 25h bundle exec unicorn -p $PORT -c ./..
You would not be charged if there are no processes being used however I suspect if you have other paid addons that you would still be charged for them.

unknown heroku error

i am experiencing following error while trying to run application on heroku
2011-06-03T11:24:25-07:00 heroku[nginx]: GET / HTTP/1.1
2011-06-03T18:24:37+00:00 heroku[router]: Error H14 (No web processes runnig)
that's the only message i am getting, and it's not even mentioned in heroku error codes at http://devcenter.heroku.com/articles/error-codes
what could be the reason of this?
heroku restart
made it work properly again
As given on http://devcenter.heroku.com/articles/error-codes
H14 - No web processes running
This is most likely the result of scaling your web processes down to zero through the client.
$ heroku scale web=0
Use the heroku ps command to determine the state of your web processes.
If problems persists after heroku restart;
Destroy the heroku app and re-create.
Heroku restart
didn't fix the issue. I added a new line in my Gemfile (just a new line, no text) to force heroku to reinstall gems and this fixed the issue.

Resources