Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

298
Views
How to run nodejs script that uses Puppeteer on Heroku

I have created a NodeJs script that uses Puppeteer to grab some data from a website and put it on a json file.

Here is my Dyno:

enter image description here

If I enter the heroku bash (heroku run bash -a my-app) and I run the script (npm run start) it works like a charm.

Instead, if I launch the script clicking on "Open app" button I get a page with the following error:

enter image description here

Having a look at logs I see this:

at=error code=H10 desc="App crashed" method=GET path="/" host=my-app.herokuapp.com request_id=653dbf69-d35c-4017-bxxf-cc0e1a5xxxce fwd="37.159.47.101" dyno= connect= service= status=503 bytes= protocol=https
2022-06-01T07:24:50.316302+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=my-app.herokuapp.com request_id=b49ac035-axxx-4372-a59e-118bcxxx6a3b fwd="37.159.47.101" dyno= connect= service= status=503 bytes= protocol=https

I have spent a lot of time searching for H10 error and I have tried every solution I encountered, none worked.

The point is: what is the right way to launch a NodeJs script since I'm using Puppeteer and then I have no web page to show? If I use the bash when I close it the script is killed as well.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

I finally figure out how to run a script that is not a web app. I have changed "web" to "worker" in the Procfile:

worker: npm start

and then turn off the web dynos and turn on the fresh new worker:

enter image description here

(You can reach the same with Heroku CLI: heroku scale web=0 worker=1)

Source of solution.

about 4 years ago · Juan Pablo Isaza Report

0

Do you installed the puppeter webpack that recomends heroku? other solution that worked for me is to use "chrome-aws-lambda" library that integrates puppeteer and work in hostings like vercel or heroku

example of the library

import chromium from "chrome-aws-lambda";
const browser = chromium.puppeteer."any puppeteer function"

i hope this help you.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!