1

I am trying to make puppeteer headless: false work with heroku. I deployed my express app on a heroku dyno and puppeteer works fine with headless: false, but I have a function that runs headless: true and it works locally, but when I try it on heroku this is the error:

Error: Failed to launch the browser process!
Missing X server or $DISPLAY
The platform failed to initialize.  Exiting.

On the puppeteer-heroku-buildpack there is a note:

Puppeteer defaults to headless: true in puppeteer.launch and this shouldn't be changed. Heroku  
doesn't have a GUI to show you chrome when running headless: false and Heroku will throw an error.

This is weird because there are other SO posts with guys having the opposite problem: headless: false works fine but the other way it breaks - maybe it worked in the past, I have no clue. I found in some SO thread an answer that suggested using xvfb to provide a fake display (he provided the necessary setup as well) but I had the same problem.

Anyway I would like to hear more from someone who managed to make puppeteer headful work on heroku, or any other platform.

Gabriel
  • 23
  • 4
  • See [Puppeteer not running in headless:false mode](https://stackoverflow.com/questions/50942859/puppeteer-not-running-in-headlessfalse-mode), [Error while excuting chrome without headless on heroku](https://stackoverflow.com/questions/48009016/error-while-excuting-chrome-without-headless-on-heroku) and [Any way to run headless=false?](https://github.com/jontewks/puppeteer-heroku-buildpack/issues/89) – ggorlen Mar 20 '22 at 14:04
  • @ggorlen Thanks a lot, first thread seems to be very helpful, I will look into it, really thank you I thought I've seen all threads on the topic. – Gabriel Mar 20 '22 at 14:24

0 Answers0