Search code examples
node.jsherokuweb-scrapingpuppeteeryarnpkg

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:

  1. Puppeteer unable to run on heroku
  2. https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md#running-puppeteer-on-heroku
  3. 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:

  1. 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?


Solution

  • 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:

    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!