Repository navigation
Description
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
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 puppeteerThis 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
Activity
github-actions commentedon Apr 2, 2024
This issue has an invalid Node.js version:
20. Versions must follow SemVer formatting. Please update the form with a valid version.Analyzer run
OrKoN commentedon Apr 2, 2024
Consider using the official Docker image we provide (it is not based on Alpine though and uses Chrome for Testing) https://github.com/puppeteer/puppeteer/pkgs/container/puppeteer Note that Alpine Chromium builds are not maintained by us, so please consider reaching out to the build maintainer or filing an issue for Chromium at crbug.com.
mohamed-badaoui commentedon Apr 2, 2024
Same issue with
OrKoN commentedon Apr 2, 2024
Try using dumpio: true to see logs from chromium. Perhaps something is missing in the Alpine image for this version.
ackava commentedon Apr 2, 2024
@OrKoN I can confirm that the issue isn't with alpine, it is failing with https://github.com/puppeteer/puppeteer/pkgs/container/puppeteer image as well. I am getting same error.
Puppeteer is not connecting to latest chrome version.
Here is the sample repo,
https://github.com/ackava/puppeteer-failing-123
mohamed-badaoui commentedon Apr 2, 2024
Recurring log messages are:
OrKoN commentedon Apr 2, 2024
@ackava you should not use the channel as it will pick-up with wrong binary: instead you shoud let Puppeteer to launch the bundled instance.
ackava commentedon Apr 2, 2024
@OrKoN I changed
index.jsto use bundledgoogle-chrome-stable.Here is the error..
OrKoN commentedon Apr 2, 2024
the stable is not the bundled version (Puppeteer bundles Chrome for Testing version as per https://pptr.dev/chromium-support), it is installed there to make sure all chrome dependencies are installed as well.
The following works for me:
Outputs
Chrome/123.0.6312.86.1 remaining item
OrKoN commentedon Apr 2, 2024
The command
docker run --init --rm -it localhost/pptr:latest(note the --init flag, it might be important). Could you please try this out and let me know if it works for you?ackava commentedon Apr 2, 2024
@OrKoN Yes I was able to get working with your example, but same on alpine doesn't work.
Does Following log indicate that
dbusis now mandetory for puppeteer? Because the official puppeteer troubleshooting for alpine doesn't mention this.OrKoN commentedon Apr 2, 2024
@ackava as far as I know it is not required and those errors are warnings. We do configure dbus in our image though to suppress them. Note that for https://pptr.dev/troubleshooting we rely largely on community contributors since we cannot test all configurations by ourselves. Could you try to configure dbus and update the guide if that helps?
ackava commentedon Apr 2, 2024
@OrKoN dbus errors show up even in your example so I believe dbus isn't the issue. I have collected following log and can you identify if anything is missing in configuration?
OrKoN commentedon Apr 2, 2024
Hm, not sure, nothing particularly stands out, but perhaps do not run in the
--single-processmode and try with--disable-gpu? maybe some graphics dependencies are required now?ackava commentedon Apr 2, 2024
@OrKoN
Thank you for your help, the culprit was
--single-process, as far as I know,--single-processwas 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.
OrKoN commentedon Apr 2, 2024
@ackava do you know where the
--single-processflag was recommended? I don't think we recommend it in Puppeteer docs. If you could open a PR to update https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md#running-on-alpine with a note about it it, it would be great.CeeBeeUK commentedon Aug 2, 2024
We have seen success in preventing this on alpine 3.20 by adding a
--disable-gpuflag into the launch args, e.g.Will time out and fail with
ProtocolError: Network.enable timed outWhereas, adding the flag, e.g.
Outputs the expected results, we are currently assuming that chromium updated something GPU related in 127+ but are too busy trying test the fix!
kennMicepad commentedon Aug 7, 2024
Yup this works for me by adding a
--disable-gpuflag . thanks!cristovao-alves commentedon Oct 16, 2024
Sharing my solution. Please refer to #11640 (comment)
mmatferneu commentedon Nov 13, 2024
I can confirm that
--disable-gpuseems to do the trick on Alpine Linux. Without it, the chromium will simply stay there, looking at your face, but will never navigate to an URL. You will see a message saying it is being controlled by automated test software, but the tab will stay on about:blank forever.Oh, you also must make sure the loopback interface is up too
ip link set lo up