question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error starting Chrome with puppeteer when deploying headless-chrome functions example

See original GitHub issue

I was looking at the documentation for Cloud Functions (https://cloud.google.com/functions/docs/concepts/nodejs-10-runtime) and wanted to deploy one of the example functions in this repo, the headless-chrome example. My deploy command was based on what I was reading in the docs site:

gcloud functions deploy screenshot --runtime nodejs10 --trigger-http --project <redacted>

The deploy succeeds, but then in the web browser when I visit the URL, the function displays the expected message if I don’t provide the URL query string parameter:

?url=https://example.com
Please provide URL as GET parameter, for example:

But it fails if I do provide a URL query string parameter, displaying the following message in the browser:

Error: could not handle the request

And the following message in the Stackdriver logs for the function:

TimeoutError: Timed out after 30000 ms while trying to connect to Chrome! The only Chrome revision guaranteed to work is r672088 at Timeout.onTimeout (/srv/functions/node_modules/puppeteer/lib/Launcher.js:351:14) at ontimeout (timers.js:436:11) at tryOnTimeout (timers.js:300:5) at listOnTimeout (timers.js:263:5) at Timer.processTimers (timers.js:223:10)

Despite the error message mentioning “30000 ms”, this happens within a few seconds.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
sterencommented, Sep 3, 2019

I confirm that the OS packages needed to run Headless Chrome (and thus puppeteer) will keep being present in the Cloud Functions environment.

1reaction
danoccommented, Sep 3, 2019

HI! I noticed that the examples were removed a few days ago in https://github.com/GoogleCloudPlatform/nodejs-docs-samples/pull/1461.

Is Puppeteer still supported in Cloud Functions?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Web Scraping with a Headless Browser: A Puppeteer Tutorial
In this article, Toptal Freelance JavaScript Developer Nick Chikovani shows how easy it is to perform web scraping using a headless browser.
Read more >
Puppeteer throws launch exception when deployed on azure ...
So we can use the package puppeteer in Azure function. ... browser = await puppeteer.launch({ headless: true }); const page = await browser....
Read more >
Creating a Puppeteer microservice to deploy to Google Cloud ...
First, we launch a Chrome instance and pass the headless: false argument to display it instead of running it headless without the GUI....
Read more >
Running headless Chromium in Azure Functions with ...
Browser automation has been around for a long time. Selenium WebDriver was a pioneer in this space. More recently, Puppeteer and Playwright have ......
Read more >
How to Use Puppeteer to Automate Chrome in an API with ...
How can we use Puppeteer in a serverless function on Netlify? Puppeteer works both with opening a visible browser UI and “headless”, meaning,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found