Search code examples
node.jsheroku

How can I keep a Node app running on Heroku which is not a server without providing $PORT?


I've written a web scraper using node.js which scrapes a particular website, gets some data from there and then tweets it. I've deployed this app on Heroku and app crashes by giving an error that $PORT couldn't be bound within 60 seconds. I've tried putting both worker: node index.js and web: node index.js in Procfile one by one, but it crashes.

Since my app is not a server hence does not need a port number, how can I keep it running with out making my app a server?


Solution

  • Turn on the worker process and off the default web process:

    $ heroku scale web=0 worker=1