mrafiqk / html-pdf-node

190 stars 118 forks source link

Error: Failed to launch the browser process! #3

Open Siddharthosatwal opened 4 years ago

Siddharthosatwal commented 4 years ago

Encountered this issue on Google Cloud Run.

Here I have a Node application in which HTML needs to be converted into PDF.


2020-08-17 19:34:24.291 IST(node:23) UnhandledPromiseRejectionWarning: Error: Failed to launch the browser process!
2020-08-17 19:34:24.291 IST/usr/src/app/node_modules/puppeteer/.local-chromium/linux-782078/chrome-linux/chrome: error while loading shared libraries: libgobject-2.0.so.0: cannot open shared object file: No such file or directory
2020-08-17 19:34:24.291 IST
2020-08-17 19:34:24.291 IST
2020-08-17 19:34:24.291 ISTTROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md
2020-08-17 19:34:24.291 IST
2020-08-17 19:34:24.291 IST at onClose (/usr/src/app/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:193:20)
2020-08-17 19:34:24.291 IST at ChildProcess.<anonymous> (/usr/src/app/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:184:79)
2020-08-17 19:34:24.291 IST at ChildProcess.emit (events.js:327:22)
2020-08-17 19:34:24.291 IST at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
mrafiqk commented 4 years ago

@Siddharthosatwal Can you please share your sample code here. So that I will help you. Thanks

mrafiqk commented 4 years ago

@Siddharthosatwal Are you facing the same error in local?

Siddharthosatwal commented 4 years ago

@Siddharthosatwal Are you facing the same error in local?

@mrafiqk No facing the same error on local.

mrafiqk commented 4 years ago

@Siddharthosatwal Are you facing the same error in local?

@mrafiqk No facing the same error on local.

@Siddharthosatwal Do you mean Not facing?

Siddharthosatwal commented 4 years ago

@Siddharthosatwal Are you facing the same error in local?

@mrafiqk No facing the same error on local.

@Siddharthosatwal Do you mean Not facing?

Yes sorry for the typo. Not facing issues in local.

mrafiqk commented 4 years ago

@Siddharthosatwal We have using the same package in our project and deployed in Heroku server. We had faced the same issue. We just added the puppeteer buildpack in Heroku server, it got worked.

FYI: image

vel007 commented 4 years ago

@Siddharthosatwal I was facing the same issue a month before. I was using heroku server. I found that there is some problem with opening browser in heroku server. For that i added puppeteer build pack as below. buildpack This solved my problem. And it is working in server

Siddharthosatwal commented 4 years ago

@Siddharthosatwal We have using the same package in our project and deployed in Heroku server. We had faced the same issue. We just added the puppeteer buildpack in Heroku server, it got worked.

FYI: image

We tried installing puppeteer on our cloud run instance but the issue was not resolved.

Siddharthosatwal commented 4 years ago

@Siddharthosatwal I was facing the same issue a month before. I was using heroku server. I found that there is some problem with opening browser in heroku server. For that i added puppeteer build pack as below. buildpack This solved my problem. And it is working in server

We tried installing puppeteer on our cloud run instance but the issue was not resolved.

einSelbst commented 3 years ago

you need to install all the missing dependencies to the machine yourself. In our case, aws ec2 with ubuntu it was the following (maybe you don't need all of them):

nabilzhafri commented 3 years ago

That's probably because your server/container is missing dependencies. See here to see which dependencies you need for your server: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md#chrome-headless-doesnt-launch-on-unix

For example, run this for ubuntu:

sudo apt-get install ca-certificates \
fonts-liberation \
libappindicator3-1 \
libasound2 \
libatk-bridge2.0-0 \
libatk1.0-0 \
libc6 \
libcairo2 \
libcups2 \
libdbus-1-3 \
libexpat1 \
libfontconfig1 \
libgbm1 \
libgcc1 \
libglib2.0-0 \
libgtk-3-0 \
libnspr4 \
libnss3 \
libpango-1.0-0 \
libpangocairo-1.0-0 \
libstdc++6 \
libx11-6 \
libx11-xcb1 \
libxcb1 \
libxcomposite1 \
libxcursor1 \
libxdamage1 \
libxext6 \
libxfixes3 \
libxi6 \
libxrandr2 \
libxrender1 \
libxss1 \
libxtst6 \
lsb-release \
wget \
xdg-utils
ghoshpushpendu commented 2 years ago

https://stackoverflow.com/a/62383642/10098625 Follow this stackoverflow. This will save your days.

The thing is install headless chrome on your server / container.

DuiLego commented 2 years ago

This works for me:

AWS- EC2 Amazon Linux Node JS

https://developers.google.com/web/tools/puppeteer/troubleshooting?hl=pl#running_puppeteer_on_aws_ec2_instance_running_amazon-linux