RicardoValdovinos / vite-react-boilerplate

A production ready, scalable starter template for Vite + React
MIT License
684 stars 91 forks source link

Playwright not compatible with alpine based images (nginx:stable-alpine) #8

Closed hakimhassani97 closed 2 months ago

hakimhassani97 commented 5 months ago

After trying this awesome boilerplate, although the configuration wasn't straightforward, I managed to set up the project using Docker.

Now, I encounter this problem with Playwright when running end-to-end tests. Here are the logs:

Error: browserType.launch: Failed to launch: Error: spawn /root/.cache/ms-playwright/chromium-1097/chrome-linux/chrome ENOENT
Call log:
  - <launching> /root/.cache/ms-playwright/chromium-1097/chrome-linux/chrome --disable-field-trial-config --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=ImprovedCookieControls,LazyFrameLoading,GlobalMediaControls,DestroyProfileOnBrowserClose,MediaRouter,DialMediaRouteProvider,AcceptCHFrame,AutoExpandDetailsElement,CertificateTransparencyComponentUpdater,AvoidUnnecessaryBeforeUnloadCheckSync,Translate,HttpsUpgrades,PaintHolding --allow-pre-commit-input --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --force-color-profile=srgb --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain --no-service-autorun --export-tagged-pdf --disable-search-engine-choice-screen --headless --hide-scrollbars --mute-audio --blink-settings=primaryHoverType=2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4 --no-sandbox --user-data-dir=/tmp/playwright_chromiumdev_profile-McfNLB --remote-debugging-pipe --no-startup-window
  - [pid=N/A] starting temporary directories cleanup
  - [pid=N/A] finished temporary directories cleanup

After some investigation, the error seems to come from the base image used for the Dockerfile which is alpine-based, that is not supported by Playwright

Here is an issue on github that discusses the the problem

What I did to temporarly solve my problem, I used the official ubuntu-based Playwright image mcr.microsoft.com/playwright for development, and nginx:stable-alpine for porduction

I don't know if this can help someone, or if someone can correct me if i'am wrong (not sure if I am being up-to-date)

RicardoValdovinos commented 4 months ago

Hi, thank you for submitting an issue!

Do you have a set of steps I can use to reproduce your dev setup? If others are using docker for development and not just for deployments then it might be a good idea to add a note in the README linking to this issue with some general steps.