Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The only Chrome revision guaranteed to work is xxx error #1347

Closed
abarkine opened this issue Nov 10, 2017 · 14 comments
Closed

The only Chrome revision guaranteed to work is xxx error #1347

abarkine opened this issue Nov 10, 2017 · 14 comments

Comments

@abarkine
Copy link

  • Puppeteer version: 0.12.0
  • Platform / OS version: Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-96-generic x86_64)

I am using puppeteer for manipulating webpages and then taking their screenshot. My local environment is macOS Sierra 10.12.2 and it is working fine for every request. However, in production, puppeteer gives following error half of the time: "Timed out after 30000 ms while trying to connect to Chrome! The only Chrome revision guaranteed to work is r508693". node_modules folder has chromium revision 508693. I didn't encounter with this error in local environment. One thing to note, in local environment, node_modules folder is in root path of the project. In production, it is in source folder which is subfolder of project root.

const puppeteer = require('puppeteer');
const express = require('express');
const app = express();
app.get('/', function(req, res) {
  (async() => {
    try {
      const browser = await puppeteer.launch({args: ['--no-sandbox']});
      const page = await browser.newPage();
      await page.goto(url, {waitUntil: 'load'});
      await page.setViewport({width: 2560, height: 1440});
      const z = 0;
      const { x, y } = await page.evaluate((z) => {
        const func1 = function () {
          return 1;
        };
        const func2 = function () {
          return 2;
        };
        return {x: func1(), y: func2()};
      }, z);
      function func3 (w) {
        return {x:1, y:2, width:3, height:4};
      }
      var clip = await page.evaluate(func3, 3);
      var clipSS = await page.screenshot({ clip });
      const fullpageSS = await page.screenshot();
      res.json({ fullpageSS, clipSS, x, y });
      await browser.close();
    } catch (error) {
      res.status(500).send('Error occured: ' + error);
      return;
    }
  })();
});
app.listen(4321);
@joelgriffith
Copy link
Contributor

I'm unable to reproduce this on browserless, and we support puppeteer@0.12.0. This statements sounds like a culprit: "In production, it is in source folder which is subfolder of project root.". Puppeteer tries to load the Chrome binary based upon location, so it's likely not able to find it.

You can probably run your script with DEBUG=* to get a ton more information. Hopefully something will be a "smoking gun" and we can start to find where your issue resides.

@abarkine
Copy link
Author

Should i use debug library(https://www.npmjs.com/package/debug) for node? Will it capture all errors or should I put debugger in specific points in code? If it is, where is the most likely place that this error comes from, is it launch command?

@joelgriffith
Copy link
Contributor

It's up to the library providers to use it, which this does https://github.com/GoogleChrome/puppeteer/blob/master/package.json#L27. Lots of other libraries and frameworks also use it, so you'll likely get a firehose of information, just fyi.

All of that said you shouldn't need to install anything on your end, just run your app like so:

DEBUG=* node app.js

Replacing app.js with wherever your script is located.

@abarkine
Copy link
Author

In order not to interrupt production machine for wekeend, I will try it on monday and let you know with the results.

@abarkine
Copy link
Author

I didn't confront with the same issue in almost two weeks so I am closing this one.

@abarkine
Copy link
Author

I have attached debug logs from node application. I couldn't identify which parts are crucial so that I have attached all of it.
debugOutput.txt

@abarkine abarkine reopened this Nov 30, 2017
@alexarvanitidismrf
Copy link

alexarvanitidismrf commented Jan 8, 2018

On OSX I solved the problem doing the following:

  1. Add to the code
const { CHROME_BIN } = process.env;
const browser = await puppeteer.launch(Object.assign({}, PUPPETEER_CONFIG, { executablePath: CHROME_BIN }));
  1. brew install -g puppeteer, which downloaded the specific compatible version of Chromium on ~/.npm-packages/lib/node_modules/puppeteer/.local-chromium/mac-508693/chrome-mac/Chromium.app/Contents/MacOS/Chromium, I then set export CHROME_BIN='.npm-packages/lib/node_modules/puppeteer/.local-chromium/mac-508693/chrome-mac/Chromium.app/Contents/MacOS/Chromium' on my ~/.bashrc

and it worked!

@grebmeg
Copy link

grebmeg commented Jan 10, 2018

I have the same error in production environment (ubuntu):

"Timed out after 30000 ms while trying to connect to Chrome! The only Chrome revision guaranteed to work is r515411"

, but on local machine (mac os) it doesn't reproduced and all screenshots was gotten correctly...

@aslushnikov
Copy link
Contributor

@20percent the logs you attached have perfectly valid pptr logs that successfully interact with the browser.

Overall, there are two reasons for this error to happen:

  1. You're using wrong version of chromium; you should try using the bundled one to mitigate the issue.
  2. You're running in a very tight environment with a lot of concurrent tasks. In this environment, chrome naturally takes long time to start, thus causing the timeout. You can try increasing the timeout.

@grebmeg this seems to be an environment issue, not pptr's one. If you think we can somehow be helpful with this, please let us know.

@robertjchristian
Copy link

Running as a worker on GCP App Engine w Docker (similar to TryPuppeteer), I see this on occasion when worker is under load. It's not anything to do with packaging, it's #2 (running in tight env) that is causing the issue to occur occasionally.

Where is the timeout setting?

Also, seems the better option would be to reduce the number of listeners running concurrently, but would be nice to see where the timeout setting anyway.

@aslushnikov
Copy link
Contributor

Where is the timeout setting?

@robertjchristian checkout timeout option in puppeteer.launch.

@jacksontong
Copy link

I'm running puppeteer in GCP App Engine with autoscaling. I saw this error when the target_utilization was 0.6 with 1 instance but when I reduced it to 0.3 it's up to 8 instances and I don't see the error anymore

env: flex
runtime: custom

automatic_scaling:
  min_num_instances: 2
  max_num_instances: 10
  cool_down_period_sec: 180
  cpu_utilization:
    target_utilization: 0.3

@adarmanto
Copy link

I also have a similar issue on puppeteer@1.0.0 running on Ubuntu 16.04 LTS 6 Gb RAM:

Error: Timed out after 30000 ms while trying to connect to Chrome! The only Chrome revision guaranteed to work is r526987

It was working great with puppeteer@0.13.0

@jackengtwistio
Copy link

@20percent the logs you attached have perfectly valid pptr logs that successfully interact with the browser.

Overall, there are two reasons for this error to happen:

  1. You're using wrong version of chromium; you should try using the bundled one to mitigate the issue.
  2. You're running in a very tight environment with a lot of concurrent tasks. In this environment, chrome naturally takes long time to start, thus causing the timeout. You can try increasing the timeout.

@grebmeg this seems to be an environment issue, not pptr's one. If you think we can somehow be helpful with this, please let us know.

After I close my vs code , it worked!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants