AlexB
AlexB

Reputation: 4546

Playwright - Can't launch Chromium when it's in node_modules (Azure Function - Linux and Windows)

I made an Azure Function that uses Playwright. It works locally, well, that part doesn't change)

Then I created Azure DevOps pipeline, so it uses Ubuntu agent, builds it with PLAYWRIGHT_BROWSERS_PATH=0, so the Chromium is downloaded to node_modules (and I see it there). Then it's released to Linux Azure Function.

But when the function runs in Azure this line:

  const crBrowser = await chromium.launch({
    executablePath:
      "./node_modules/playwright-chromium/.local-browsers/chromium-827102/chrome-linux/chrome",
  });

throws this error:

Error: spawn ./node_modules/playwright-chromium/.local-browsers/chromium-827102/chrome-linux/chrome EACCES =========================== logs =========================== ./node_modules/playwright-chromium/.local-browsers/chromium-827102/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,LazyFrameLoading --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-JZVt2S --remote-debugging-pipe --headless --hide-scrollbars --mute-audio --blink-settings=primaryHoverType=2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4 --no-sandbox --no-startup-window ============================================================

I tried this with Windows and Linux - same thing, just different wording.

Upvotes: 3

Views: 2980

Answers (1)

AlexB
AlexB

Reputation: 4546

Anthony Chu (the author of the article mentioned in the comments and the one that made me to try this in the first place) replied that he hasn't been able to make it work with playwright-sharp. It only works with puppeteer-sharp.

Upvotes: 0

Related Questions