apify / apify-actor-docker

Base Docker images for Apify actors.
https://hub.docker.com/u/apify
Apache License 2.0
70 stars 22 forks source link

actor-node-playwright-chrome - cannot launch chrome #105

Closed mbledkowski closed 1 year ago

mbledkowski commented 1 year ago
WARN  PlaywrightCrawler: Reclaiming failed request back to the list or queue. browserType.launchPersistentContext:
╔════════════════════════════════════════════════════════════════════════════════════════════════╗
║ Looks like you launched a headed browser without having a XServer running.                     ║
║ Set either 'headless: true' or use 'xvfb-run <your-playwright-app>' before running Playwright. ║
║                                                                                                ║
║ <3 Playwright Team                                                                             ║
╚════════════════════════════════════════════════════════════════════════════════════════════════╝
=========================== logs ===========================
<launching> /home/myuser/pw-browsers/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 --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 --no-sandbox --proxy-server=http://127.0.0.1:41115 --proxy-bypass-list=<-loopback> --disable-blink-features=AutomationControlled --user-data-dir=/tmp/playwright_chromiumdev_profile-FYa8eg --remote-debugging-pipe about:blank
<launched> pid=239
[pid=239][err] [239:252:0523/180015.423709:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[pid=239][err] [239:239:0523/180015.429715:ERROR:ozone_platform_x11.cc(239)] Missing X server or $DISPLAY
[pid=239][err] [239:239:0523/180015.429736:ERROR:env.cc(255)] The platform failed to initialize.  Exiting.

How can I fix this issue? Using crawlee.

B4nan commented 1 year ago

Either enabled headless mode as suggested in the warning, or adjust the docker file, I believe current versions all have the start script fixed already.

https://github.com/apify/apify-actor-docker/blob/master/node-playwright-chrome/Dockerfile#L110

Mainly the CMD ./start_xvfb_and_run_cmd.sh is important.

mbledkowski commented 1 year ago

I use the 18-beta version, but still got the same issue :/ @B4nan

B4nan commented 1 year ago

This is not about the tags, this is about how your dockerfile looks like. It needs to have that line I highlighted in the previous comment.