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.

[BUG] Won't launch Chromium inside Node Alpine Docker container

See original GitHub issue

Context:

  • Playwright Version: 1.1.1
  • Operating System: Dockerized Alpine Linux
  • Node version: 12.14
  • Browser: Chromium
  • Extra: Docker node:12.14-alpine

Code Snippet

Dockerfile

FROM node:12.14-alpine

# Install dependencies (i.e. for compiling bcrypt)
RUN apk --no-cache add --virtual native-deps g++ gcc libgcc libstdc++ linux-headers autoconf automake make nasm python git chromium                                          && \
  npm install --quiet node-gyp -g

Code:

const browser = await playwright.chromium.launch({
      headless: true,
      args: ['--no-sandbox', '--disable-setuid-sandbox'],
});

Describe the bug

Playwright is working fine on our local machines (OSX) but once we deploy it to our staging environment, which is in Docker, we get this error complaining can’t launch browser:


2020-07-02T15:25:03.614-07:00 | [Nest] 32   - 07/02/2020, 10:25:03 PM   [ExceptionsHandler] Failed to launch browser: Error: spawn /root/.cache/ms-playwright/chromium-775089/chrome-linux/chrome ENOENT
-- | --
  | 2020-07-02T15:25:03.614-07:00 | =================== chromium.launch logs ===================
  | 2020-07-02T15:25:03.614-07:00 | <launching> /root/.cache/ms-playwright/chromium-775089/chrome-linux/chrome --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=TranslateUI,BlinkGenPropertyTrees,ImprovedCookieControls,SameSiteByDefaultCookies --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --disable-sync --force-color-profile=srgb --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain --user-data-dir=/tmp/playwright_chromiumdev_profile-LahnmC --remote-debugging-pipe --headless --hide-scrollbars --mute-audio --no-sandbox --disable-setuid-sandbox --no-startup-window
  | 2020-07-02T15:25:03.614-07:00 | ============================================================
  | 2020-07-02T15:25:03.614-07:00 | Note: use DEBUG=pw:api environment variable and rerun to capture Playwright logs. +851342ms
  | 2020-07-02T15:25:03.614-07:00 | Error: Failed to launch browser: Error: spawn /root/.cache/ms-playwright/chromium-775089/chrome-linux/chrome ENOENT
  | 2020-07-02T15:25:03.614-07:00 | =================== chromium.launch logs ===================
  | 2020-07-02T15:25:03.614-07:00 | <launching> /root/.cache/ms-playwright/chromium-775089/chrome-linux/chrome --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=TranslateUI,BlinkGenPropertyTrees,ImprovedCookieControls,SameSiteByDefaultCookies --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --disable-sync --force-color-profile=srgb --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain --user-data-dir=/tmp/playwright_chromiumdev_profile-LahnmC --remote-debugging-pipe --headless --hide-scrollbars --mute-audio --no-sandbox --disable-setuid-sandbox --no-startup-window
  | 2020-07-02T15:25:03.614-07:00 | ============================================================
  | 2020-07-02T15:25:03.614-07:00 | Note: use DEBUG=pw:api environment variable and rerun to capture Playwright logs.
  | 2020-07-02T15:25:03.614-07:00 | at ChildProcess.<anonymous> (/usr/app/node_modules/playwright/lib/server/processLauncher.js:51:20)
  | 2020-07-02T15:25:03.614-07:00 | at Object.onceWrapper (events.js:313:26)
  | 2020-07-02T15:25:03.614-07:00 | at ChildProcess.emit (events.js:223:5)
  | 2020-07-02T15:25:03.614-07:00 | at ChildProcess.EventEmitter.emit (domain.js:475:20)
  | 2020-07-02T15:25:03.614-07:00 | at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)
  | 2020-07-02T15:25:03.614-07:00 | at onErrorNT (internal/child_process.js:456:16)
  | 2020-07-02T15:25:03.614-07:00 | at processTicksAndRejections (internal/process/task_queues.js:81:21)

Please help! Thank you.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
jaequerycommented, Jul 3, 2020

@aslushnikov are you aware of this? https://github.com/Zenika/alpine-chrome#how-to-use-with-playwright Looks like they have an Alpine based Docker container for running Playwright.

I haven’t tried this yet but I’m wondering if you are aware of this and if this would work?

0reactions
aslushnikovcommented, Jul 8, 2020

are you aware of this? https://github.com/Zenika/alpine-chrome#how-to-use-with-playwright Looks like they have an Alpine based Docker container for running Playwright.

@jaequery This looks very nice! Thank you for pointing it here!

Read more comments on GitHub >

github_iconTop Results From Across the Web

docker alpine with node js and chromium headless - puppeter
I'm trying to run a custom node command from within an Alpine linux ... js and chromium headless - puppeter - failed to...
Read more >
docker alpine with node js and chromium headless - puppeter
This worked for me. Use Puppeteer v0.13.0. As of writing this comment, the latest version of Puppeteer is not compatible with chromium in ......
Read more >
Puppeteer in alpine docker with chromium headless dosent ...
I'm trying to use pageres in my bash script for grabbing screenshot in heruko. But running pageres with alpine:latest throws error with ...
Read more >
Chrome Beta 92 Linux crashes on startup inside docker instance
Issue 1228625: Chrome Beta 92 Linux crashes on startup inside docker instance · 1. Build docker container: docker build --no-cache --tag=test/chromium92:latest .
Read more >
How to set up a Headless Chrome Node.js server in Docker
Setting up a browser to run inside a container can help boost flexibility and scalability. Here's how to set up a headless Chrome...
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