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

Cannot run Puppeteer in sandbox mode? #17

Open
bantic opened this issue Oct 25, 2019 · 3 comments · May be fixed by #18
Open

Cannot run Puppeteer in sandbox mode? #17

bantic opened this issue Oct 25, 2019 · 3 comments · May be fixed by #18

Comments

@bantic
Copy link

bantic commented Oct 25, 2019

Thanks for this github action, btw! It's been super useful to test a chrome extension!

I was able to get it running, but when puppeteer attempted to launch, it reported this failure:

     Error: Failed to launch chrome!
[70:70:1025/151225.400209:ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.

I was able to fix this by adding the --no-sandbox arg, but I wondered if it is possible to run in sandbox mode.

According to the sandbox part of the troubleshooting docs, it looks like perhaps the Dockerfile needs to run sudo sysctl -w kernel.unprivileged_userns_clone=1 and then switch into a non-privileged user before it launches the puppeteer browser.

I tried adding the sysctl command to my test script, and it appears that it works, but even so I was still unable to run without the --no-sandbox arg.

@jcblw
Copy link
Member

jcblw commented Oct 26, 2019

Hmm, so there is a little further down in that document some stuff about using puppeteer in docker. I assume there is some additional steps like USER pptruser which switches to the sandboxed user.

@jcblw
Copy link
Member

jcblw commented Oct 26, 2019

I would love to support this in the action, I'll take some time today to play around with it

@jcblw jcblw linked a pull request Oct 27, 2019 that will close this issue
@alexanderdavide
Copy link
Contributor

alexanderdavide commented May 17, 2021

I experienced the same issue where puppeteer can only launch when --no-sandbox is defined.

The configuration must therefore look like this:

browser = await puppeteer.launch({
      args: ['--no-sandbox'],
      executablePath: process.env.PUPPETEER_EXEC_PATH, // set by docker container
      headless: false,
    });

There does not seem to happen any progress on #18. I suggest to add this missing information in README.md.

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

Successfully merging a pull request may close this issue.

3 participants