crawlee icon indicating copy to clipboard operation
crawlee copied to clipboard

`launchContext.launcher` uses `chrome` on Platform despite being set to `firefox`

Open szmarczak opened this issue 3 years ago • 3 comments

const crawler = new PlaywrightCrawler({
    launchContext: {
        launcher: playwright.firefox,
    },
    async requestHandler({ page }) { ... },
});

await crawler.run(['https://api.apify.com/v2/browser-info?1', 'https://api.apify.com/v2/browser-info?2']);

https://console.apify.com/view/runs/1phBbPE1cYSU5gF2a https://github.com/apify/crawlee/actions/runs/2841856507

szmarczak avatar Aug 11 '22 19:08 szmarczak

I see you're using the Chrome Dockerfile. Firefox is not installed in that one. You need to use the Firefox one.

FROM apify/actor-node-playwright-chrome:16

⬇️

FROM apify/actor-node-playwright-firefox:16

Maybe SDK or Crawlee (not sure where the dockerfile definitions live now, I guess in Crawlee) could throw a helpful error if running in Docker and the browser is not installed @B4nan ?

mnmkng avatar Aug 12 '22 08:08 mnmkng

Dockerfiles are in the templates, crawlee has its own templates just like apify-cli has, it would be better to have this handled in both.

But looking at the logs, I dont see any easily understandable error message we could catch and rethrow, it seems quite criptic to me. Maybe we could check it explicitly somehow (even via env vars that would be added to the base docker images.

B4nan avatar Aug 12 '22 08:08 B4nan

Yeah, an explicit check would be best. Either somehow check if the browser is installed in its expected location or via the env var.

mnmkng avatar Aug 12 '22 09:08 mnmkng