question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
tripti825commented, 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

0reactions
Ivan-Perezcommented, May 2, 2018

@savethedave I just yum install chomium.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't execute Puppeteer with user "apache" (CentOS 7)
Hello! I'm using the example code found in this repository to create a PDF from a webpage. When I execute the script from...
Read more >
setup puppeteer centos7 Code Example
... -E bash - yum install nodejs Step 2 :- Install Puppeteer In CentOS 7 ... For running Puppeteer in sandbox mode we...
Read more >
Puppeteer can't start chromium when run by phussion ...
I have a Node.js application which is generating dynamic PDFs using puppeteer, while executing in a normal Node context everything works ...
Read more >
Puppeteer documentation - DevDocs
Puppeteer 7.1.0 API documentation with instant search, offline support, keyboard shortcuts, mobile version, and more.
Read more >
Troubleshooting - Puppeteer
Make sure all the necessary dependencies are installed. You can run ldd chrome | grep not on a Linux machine to check which...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found