Can't execute Puppeteer with user "apache" (CentOS 7)
See original GitHub issueTell 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.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (1 by maintainers)
Top GitHub Comments
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
@savethedave I just
yum install chomium
.