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

chrome_crashpad_handler: --database is required Only On Docker #2633

Closed
wilsonbredaneto opened this issue May 8, 2024 · 2 comments
Closed

Comments

@wilsonbredaneto
Copy link

Hey guys.

I have an app with dotnet 3.1 running on docker with alpine. On this app I've install PuppeteerSharp 17.

But, when I call the following command on docker I got this following error:

command await using var browser = await Puppeteer.LaunchAsync(new LaunchOptions
{
Headless = true,
Args = new[] {
"--no-sandbox",
},
ExecutablePath = "/usr/bin/chromium-browser"
});

Error: PuppeteerSharp.ProcessException: Failed to launch browser! chrome_crashpad_handler: --database is required\nTry 'chrome_crashpad_handler --help' for more information.\n[999:999:0508/140237.277460:ERROR:socket.cc(120)] recvmsg: Connection reset by peer (104)\n\n at PuppeteerSharp.States.ProcessStartingState.StartCoreAsync(LauncherBase p) in /home/runner/work/puppeteer-sharp/puppeteer-sharp/lib/PuppeteerSharp/States/ProcessStartingState.cs:line 84\n at PuppeteerSharp.States.ProcessStartingState.StartCoreAsync(LauncherBase p) in /home/runner/work/puppeteer-sharp/puppeteer-sharp/lib/PuppeteerSharp/States/ProcessStartingState.cs:line 89\n at PuppeteerSharp.Launcher.LaunchAsync(LaunchOptions options) in /home/runner/work/puppeteer-sharp/puppeteer-sharp/lib/PuppeteerSharp/Launcher.cs:line 68\n at PuppeteerSharp.Launcher.LaunchAsync(LaunchOptions options) in /home/runner/work/puppeteer-sharp/puppeteer-sharp/lib/PuppeteerSharp/Launcher.cs:line 99

Here's my dockerfile:

      _#####################
      #PUPPETEER RECIPE
      #####################
      # Install latest chrome dev package and fonts to support major charsets (Chinese, Japanese, Arabic, Hebrew, Thai and a few others)
      # Note: this installs the necessary libs to make the bundled version of Chromium that Puppeteer
      # installs, work.
      RUN echo "https://dl-cdn.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories \
      && echo "https://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories \
      && echo "https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \
      && echo "https://dl-cdn.alpinelinux.org/alpine/v3.12/main" >> /etc/apk/repositories \
      && apk upgrade -U -a \
      && apk add \
      libstdc++ \
      chromium \
      harfbuzz \
      nss \
      freetype \
      ttf-freefont \
      font-noto-emoji \
      wqy-zenhei \
      && rm -rf /var/cache/* \
      && mkdir /var/cache/apk
      
      # Set an environment variable to use that Chrome.
      ENV PUPPETEER_EXECUTABLE_PATH "/usr/bin/chromium-browser"
      #####################
      #END PUPPETEER RECIPE
      #####################_

When I try to run my application on my computer, it works well.

Can you help me with that, pls?

@inwenis
Copy link

inwenis commented May 13, 2024

Try this in your docker file. It seems new puppeteer instructs chrome to keep its files somewhere where chrome can't access them. Telling chromium to use /tmp did the trick for me.

ENV XDG_CONFIG_HOME=/tmp/.chromium
ENV XDG_CACHE_HOME=/tmp/.chromium

puppeteer/puppeteer#11023 (comment)

@wilsonbredaneto
Copy link
Author

Try this in your docker file. It seems new puppeteer instructs chrome to keep its files somewhere where chrome can't access them. Telling chromium to use /tmp did the trick for me.

ENV XDG_CONFIG_HOME=/tmp/.chromium
ENV XDG_CACHE_HOME=/tmp/.chromium

puppeteer/puppeteer#11023 (comment)

It works for me. Thanks @inwenis.

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

No branches or pull requests

2 participants