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

Can't execute Puppeteer with user "apache" (CentOS 7) #2441

Closed
Ivan-Perez opened this Issue Apr 25, 2018 · 6 comments

Comments

Projects
None yet
4 participants
@Ivan-Perez
Copy link

Ivan-Perez commented Apr 25, 2018

Tell us about your environment:

  • Puppeteer version: 1.3.0
  • Platform / OS version: CentOS 7.4.1708 (Core)
  • Node.js version: 8.11.1

What steps will reproduce the problem?

I'm using the example code found in this repository to create a PDF from a webpage.

What is the expected result?

The PDF should have been generated correctly.

What happens instead?

An error occurs on the line const browser = await puppeteer.launch() (i.e., when Chromium launches). This is the trace:

(node:14832) UnhandledPromiseRejectionWarning: Error: Failed to launch chrome!
[0424/165455.239499:ERROR:icu_util.cc(133)] Invalid file descriptor to ICU data received.
[0424/165455.239717:FATAL:content_main_delegate.cc(53)] Check failed: false.
#0 0x55f27f255b0c base::debug::StackTrace::StackTrace()
#1 0x55f27f26e780 logging::LogMessage::~LogMessage()
#2 0x55f27d5f7d23 content::ContentMainDelegate::TerminateForFatalInitializationError()
#3 0x55f27ef90deb content::ContentMainRunnerImpl::Initialize()
#4 0x55f27ef9ab72 service_manager::Main()
#5 0x55f27ef8ff14 content::ContentMain()
#6 0x55f28309f9b9 headless::(anonymous namespace)::RunContentMain()
#7 0x55f28309fa42 headless::HeadlessBrowserMain()
#8 0x55f27ef97f9d headless::HeadlessShellMain()
#9 0x55f27d5f61ac ChromeMain
#10 0x7efcaad45c05 __libc_start_main
#11 0x55f27d5f602a _start

The node script (which uses Puppeteer) is invoked from PHP, and so it is run with the user apache on my server. Anyway, if instead of running it from PHP I execute the node script from the console with my own user, it works OK, but if I "sudo apache", then the same error happens again.

What is causing the error? Something related to apache user's permissions? I've followed all troubleshotting guides but I had no luck at the moment.

@aslushnikov

This comment has been minimized.

Copy link
Contributor

aslushnikov commented Apr 26, 2018

@Ivan-Perez I'm not sure what it is, but this seems to be related to the permissions for the apache user rather then pptr project itself. I'd try asking on chromium-dev.

Other then that, I don't think we'll be able to help much here.

@Ivan-Perez

This comment has been minimized.

Copy link
Author

Ivan-Perez commented Apr 27, 2018

Finally I found a way to workaround the issue.

Instead of using the bundled version of Chromium, I tried to install Chromium on my system (and configured puppeteer to use it). The version installed system-wide doesn't exibit that weird issue - I don't know why.

Thanks!

@savethedave

This comment has been minimized.

Copy link

savethedave commented Apr 28, 2018

@Ivan-Perez glad you got this working. I'm having same issue. Did you use any blog, or other guide, to install standalone version of Chromium? Would appreciate any pointers.

@savethedave

This comment has been minimized.

Copy link

savethedave commented Apr 28, 2018

@Ivan-Perez Found a solution to my situation. Had been using an independent Chrome install script here: https://intoli.com/blog/installing-google-chrome-on-centos/

Google messed up one of the repositories, so the script stopped working about 2 days ago. In the comments though there's a quick way to edit the script to make it work again.

FWIW.

@Ivan-Perez

This comment has been minimized.

Copy link
Author

Ivan-Perez commented May 2, 2018

@savethedave I just yum install chomium.

@tripti825

This comment has been minimized.

Copy link

tripti825 commented Jun 8, 2018

Mine solved this issue with
sudo setfacl -R -m g:www-data:rX node_modules/puppeteer/.local-chromium/
and
sudo setfacl -dR -m g:www-data:rX node_modules/puppeteer/.local-chromium/

basically a file-system permission on chromium used by puppeteer

https://stackoverflow.com/questions/50005153/error-executing-puppeteer-from-php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.