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.