Puppeteer error while running in ubuntu machine

672 views Asked by At

when I run puppeteer on Ubuntu I get this error:

UnhandledPromiseRejectionWarning: Error: Unable to launch browser, error message: Failed to launch the browser process!
[2098647:2098647:0520/162023.317120:ERROR:vaapi_wrapper.cc(594)] Could not get a valid VA display
[2098647:2098647:0520/162023.317252:ERROR:gpu_init.cc(426)] Passthrough is not supported, GL is egl


TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md

    at Cluster.<anonymous> (/root/Desktop/Copart/node_modules/puppeteer-cluster/dist/Cluster.js:119:23)
    at Generator.throw (<anonymous>)
    at rejected (/root/Desktop/Copart/node_modules/puppeteer-cluster/dist/Cluster.js:6:65)
    at process._tickCallback (internal/process/next_tick.js:68:7)

Here are my puppeteer options:

 pupOptions: {
    headless: false,
    args: [
      "--incognito",
      "--disable-gpu",
      "--disable-dev-shm-usage",
      "--disable-setuid-sandbox",
      "--no-first-run",
      "--no-sandbox",
      "--no-zygote",
    ],
    defaultViewport: null,
    slowMo: 10,
    sameDomainDelay: 1000,
    retryDelay: 3000,
    workerCreationDelay: 3000,
    timeout: 30000000,
    userDataDir: "/root/.config/google-chrome",
    executablePath: "/opt/google/chrome/google-chrome",
  }

Also, here is the plugins that I use:

const puppeteer = require("puppeteer-extra");
const RecaptchaPlugin = require("puppeteer-extra-plugin-recaptcha");

I tried killing google instance before running code but still didn't work

Also, I would like to mention that it works when using "puppeteer-cluster"

Anyone have any idea or solution for this? Thanks a lot for the help!

2

There are 2 answers

0
Mike On

I had to remove "--disable-gpu", from args

0
user19822844 On

If you are running puppeteer on Ubuntu server, you should try turning headless: false to headless: true

if there is no GUI on your system, then it can't show you the browser