puppeteer: Failed to launch chrome

Steps to reproduce

Tell us about your environment:

  • Puppeteer version: 1.9.0
  • Platform / OS version: Google Cloud Functions
  • Node.js version: 8

What steps will reproduce the problem?

Deploying the following code to GCF. Try executing it.

code
 exports.test = async (req, res) => {
  const puppeteer = require('puppeteer')
  const browser = await puppeteer.launch({
    args: ['--no-sandbox']
  })

  const pages = await browser.pages()
  const page = pages[0]

  await page.goto('https://www.google.com')
  await browser.close()
  return res.status(200).send('')
}

What happens instead?

gcloud functions call test --project=[redacted] --region=europe-west1
error: |
  Error: function crashed. Details:
  Failed to launch chrome!
  /srv/node_modules/puppeteer/.local-chromium/linux-594312/chrome-linux/chrome: error while loading shared libraries: libXcursor.so.1: cannot open shared object file: No such file or directory

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 30 (7 by maintainers)

Most upvoted comments

Thanks for your help reporting and diagnosing the issue. Our engineering team has identified the root cause and is rolling out a fix today.

This issue was for Puppeteer on Cloud Functions, which has now been fixed. Please open a new one if you are encountering issues on a different platform. The root cause will not be the same.

I’m also seeing this on deploys to Google Cloud Functions today

Seems to be fixed now, thanks!

Running the following script on GCF:

const exec = require('child_process').execFileSync;
const puppeteer = require('puppeteer');

exports.screenshot = async (req, res) => {
  let output = exec('ldd', [puppeteer.executablePath()], {encoding: 'utf8'});
  res.send(output);
};

The following libs are reported missing:

	libXcursor.so.1 => not found
	libnss3.so => not found
	libnssutil3.so => not found
	libsmime3.so => not found
	libnspr4.so => not found
	libasound.so.2 => not found
	libatk-1.0.so.0 => not found
	libatk-bridge-2.0.so.0 => not found
	libgtk-3.so.0 => not found
	libgdk-3.so.0 => not found

These where in the filesystem in a dump I made a few days ago.

I am experiencing the same issues when using Puppeteer in a Firebase Cloud Function.

I tried changing the Puppeteer version to previous versions as recommended above (1.61, 1.62, 1.7, and 1.8) and redeploying only for it to work intermediately and then not at all if deployed again.

@steren - Is this a file permission issue with Google Cloud Functions + Puppeteer? It looks like Chromium is being added but not accessed.