puppeteer: [Bug]: Alpine ProtocolError after Chrome 123.0.6312.86 Update

Minimal, reproducible example

const options = [
    '--disable-background-networking',
    '--disable-background-timer-throttling',
    '--disable-backgrounding-occluded-windows',
    '--disable-breakpad',
    '--disable-client-side-phishing-detection',
    '--disable-component-update',
    '--disable-default-apps',
    '--disable-dev-shm-usage',
    '--disable-domain-reliability',
    '--disable-extensions',
    '--disable-features=AudioServiceOutOfProcess',
    '--disable-hang-monitor',
    '--disable-ipc-flooding-protection',
    '--disable-notifications',
    '--disable-offer-store-unmasked-wallet-cards',
    '--disable-popup-blocking',
    '--disable-print-preview',
    '--disable-prompt-on-repost',
    '--disable-renderer-backgrounding',
    '--disable-setuid-sandbox',
    '--disable-speech-api',
    '--disable-sync',
    '--disk-cache-size=33554432',
    // '--hide-scrollbars',
    // '--ignore-gpu-blacklist',
    // '--metrics-recording-only',
    '--mute-audio',
    '--no-default-browser-check',
    '--no-first-run',
    '--no-pings',
    '--no-sandbox',
    '--no-zygote',
    '--password-store=basic',
    '--use-gl=swiftshader',
    '--use-mock-keychain',
    '--single-process',
    '--autoplay-policy=no-user-gesture-required',
    // '--enable-logging=stderr',
    // '--v=1',
    // '--disable-gpu',
    //   '--window-size=400,800',
];
const pup = await  puppeteer.launch({
        executablePath: globalEnv.puppeteerExecutablePath,
        userDataDir: "/tmp",
        args: options,
        ignoreHTTPSErrors: true,
        ignoreDefaultArgs: ["--mute-audio"],
        timeout: 5000,
   });

const page = await pup.newPage(...

Error string

ProtocolError: Network.enable timed out. Increase the ‘protocolTimeout’ setting in launch/connect calls for a higher timeout if needed.

Bug behavior

  • Flaky
  • PDF

Background

I have simple container that downloads and builds puppeteer on Alpine and following is the container source.

RUN apk add --no-cache \
      chromium \
      nss \
      freetype \
      harfbuzz \
      ca-certificates \
      ttf-freefont

ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser

RUN addgroup -S pptruser && adduser -S -G pptruser pptruser \
    && mkdir -p /home/pptruser/Downloads /app \
    && chown -R pptruser:pptruser /home/pptruser \
    && chown -R pptruser:pptruser /app

RUN npm install puppeteer

This was working file till 20th March 2024, this is as far as I could go back, what it means that prior to 20th March 2024, the chromium version on alpine was running correctly.

Expectation

Puppeteer should work with Chromium 123.0.6312.86-r0 on Alpine, https://pkgs.alpinelinux.org/package/edge/community/x86_64/chromium ,

Container image prior to this version was working correctly, I don’t know how to manually install previous chromium version on alpine to backtrack, if someone can help, I can backtrack old chromium version and get working version.

Reality

The last build of latest chromium was published on 27th March. And puppeteer does not connect to launched instance.

I can confirm that the instance launches process correctly, chromium process starts in headless mode but the node script hungs up till 180 seconds and throws following error.

ProtocolError: Network.enable timed out. Increase the 'protocolTimeout' setting in launch/connect calls for a higher timeout if needed.
2024-04-02 11:37:24     at Callback.<instance_members_initializer> (/app/node_modules/puppeteer-core/src/common/CallbackRegistry.ts:114:12)
2024-04-02 11:37:24     at Callback (/app/node_modules/puppeteer-core/src/common/CallbackRegistry.ts:119:3)
2024-04-02 11:37:24     at CallbackRegistry.create (/app/node_modules/puppeteer-core/src/common/CallbackRegistry.ts:27:22)
2024-04-02 11:37:24     at Connection._rawSend (/app/node_modules/puppeteer-core/src/cdp/Connection.ts:120:22)
2024-04-02 11:37:24     at CdpCDPSession.send (/app/node_modules/puppeteer-core/src/cdp/CDPSession.ts:95:29)
2024-04-02 11:37:24     at NetworkManager.addClient (/app/node_modules/puppeteer-core/src/cdp/NetworkManager.ts:124:14)
2024-04-02 11:37:24     at FrameManager.initialize (/app/node_modules/puppeteer-core/src/cdp/FrameManager.ts:217:30)
2024-04-02 11:37:24     at CdpPage.#initialize (/app/node_modules/puppeteer-core/src/cdp/Page.ts:375:28)
2024-04-02 11:37:24     at Function._create (/app/node_modules/puppeteer-core/src/cdp/Page.ts:106:27)
2024-04-02 11:37:24     at <anonymous> (/app/node_modules/puppeteer-core/src/cdp/Target.ts:249:24)

Puppeteer configuration file (if used)

No response

Puppeteer version

22.6.1

Node version

20

Package manager

npm

Package manager version

Latest

Operating system

Linux

About this issue

  • Original URL
  • State: closed
  • Created 3 months ago
  • Reactions: 3
  • Comments: 16

Most upvoted comments

@OrKoN

Thank you for your help, the culprit was --single-process, as far as I know, --single-process was mandatory on AWS Lambda Images.

I haven’t tested this on other distro but if single process is an issue on the recent chrome build then where shall I post this information? It would be useful for lot of people.

Hm, not sure, nothing particularly stands out, but perhaps do not run in the --single-process mode and try with --disable-gpu? maybe some graphics dependencies are required now?