Closed
Description
Running this example code from the README:
const puppeteer = require('puppeteer');
(async() => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://example.com');
await page.screenshot({path: 'example.png'});
browser.close();
})();
I get the following error output:
(node:30559) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Failed to connect to chrome!
(node:30559) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Platform info:
% uname -a
Linux localhost 3.14.0 #1 SMP PREEMPT Thu Jul 13 12:08:15 PDT 2017 x86_64 GNU/Linux
% lsb_release -a
Distributor ID: Debian
Description: Debian GNU/Linux 9.0 (stretch)
Release: 9.0
Codename: stretch
% node --version
v8.1.1
% cat package.json
{
"dependencies": {
"puppeteer": "^0.9.0"
}
}
Activity
Garbee commentedon Aug 16, 2017
This is working fine here on Elementary OS. I'm downloading a Debian installer now to try this out in a VM.
aslushnikov commentedon Aug 16, 2017
That's interesting. Could you please:
node_modules/puppeteer/.local-chromium
)dumpio
flag to thepuppeteer.launch
) and check what's in the stderr:fortes commentedon Aug 16, 2017
Can't launch the local chrome:
I should have mentioned that this is a headless machine that I'm ssh'd into. Given that this is for headless Chrome, I assume that scenario is still supported?
Garbee commentedon Aug 16, 2017
I think in the case of Debian systems you still need https://packages.debian.org/sid/libx11-xcb1 to run headless. That way the system has some of the API calls it needs to to do the rendering calculations.
Garbee commentedon Aug 16, 2017
The action to resolve this (which I'm working on now) is getting a list of all the required dependencies to run Chromium. Straight from the Debian the requirements are below. Documenting this for a PR shortly.
Dependencies for debian
fortes commentedon Aug 16, 2017
Already have that installed, perhaps a different package is needed?
aslushnikov commentedon Aug 16, 2017
@fortes so do dependencies from #290 (comment) help?
fortes commentedon Aug 16, 2017
I've installed those and can now run
chrome --help
. However, if I try to runchrome -v
, I get the following:Garbee commentedon Aug 16, 2017
Check the sandbox docs linked to in that error and see if they can help you get it working. Either the security sandbox is messed up on Debian right now or something funky is happening to trigger it to need a non-kernel one. I'm looking into this once this VM server gets installed.
aslushnikov commentedon Aug 16, 2017
This should be solved with the '--no-sandbox' flag:
paulirish commentedon Aug 16, 2017
It's worth considering adding both
--no-sandbox --disable-setuid-sandbox
to the default flags on linux.In chrome-launcher/lighthouse we're already including
--disable-setuid-sandbox
and plan to add--no-sandbox
soon for this reason.Garbee commentedon Aug 16, 2017
I have always strongly urged people to never turn off the sandbox without a good cause, even in tests. It is a major part of the security system from what I understand.
I'm setting up a squeaky clean and fresh Debian VM to run some install steps in. We should be able to have it well documented how to get it operating without compromising system security.
I recall PHPStorm for example having an issue where it was serving on localhost, so a remote code execution exploit was opened up for any site including code that would look for the port in use and take advantage of a flaw in that server. Let's not open people up to security issues by disabling the sandbox here. Where they could be visiting any number of sites including code that looks for exploits to abuse.
[-]Unhandled Promise Rejection[/-][+]Chrome Headless doesn't launch on Debian[/+]fortes commentedon Aug 16, 2017
Still no luck w/ those two flags:
Same warning when just with
--no-sandbox
Garbee commentedon Aug 16, 2017
Just as a quick update, I'm like 20-40ish minutes out from starting on testing the install procedure. Downloading packages now for a fresh net install of Debian 9. So, I should get back to you shortly with exact steps to reproduce. It just won't be as fast as something that doesn't require a full OS install. 😄
319 remaining items