Using Puppeteer in Google Cloud Functions
Setup
package.js
{
"name": "sample-http",
"version": "0.0.1",
"dependencies": {
"puppeteer": "^1.9.0"
}
}
Problem
const browser = await puppeteer.launch();
// Error: Failed to launch chrome!
Solution
const browser = await puppeteer.launch({
args: [
'--no-sandbox',
'--disable-setuid-sandbox',
]
});
Reference to puppeteerl