From 56719db0cab7c68e547a83658cdee535b097d7f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jind=C5=99ich=20B=C3=A4r?= Date: Wed, 18 Dec 2024 13:37:59 +0100 Subject: [PATCH] chore: pass the `--disable-gpu` flag in all Chrome templates --- templates/js-crawlee-playwright-chrome/src/main.js | 7 +++++++ templates/js-crawlee-puppeteer-chrome/src/main.js | 7 +++++++ templates/ts-crawlee-playwright-chrome/src/main.ts | 7 +++++++ templates/ts-crawlee-puppeteer-chrome/src/main.ts | 7 +++++++ 4 files changed, 28 insertions(+) diff --git a/templates/js-crawlee-playwright-chrome/src/main.js b/templates/js-crawlee-playwright-chrome/src/main.js index 327c029a..0fdadac1 100644 --- a/templates/js-crawlee-playwright-chrome/src/main.js +++ b/templates/js-crawlee-playwright-chrome/src/main.js @@ -24,6 +24,13 @@ const proxyConfiguration = await Actor.createProxyConfiguration(); const crawler = new PlaywrightCrawler({ proxyConfiguration, requestHandler: router, + launchContext: { + launchOptions: { + args: [ + '--disable-gpu', // Mitigates the "crashing GPU process" issue in Docker containers + ] + } + } }); await crawler.run(startUrls); diff --git a/templates/js-crawlee-puppeteer-chrome/src/main.js b/templates/js-crawlee-puppeteer-chrome/src/main.js index 415b4291..e656f940 100644 --- a/templates/js-crawlee-puppeteer-chrome/src/main.js +++ b/templates/js-crawlee-puppeteer-chrome/src/main.js @@ -20,6 +20,13 @@ const proxyConfiguration = await Actor.createProxyConfiguration(); const crawler = new PuppeteerCrawler({ proxyConfiguration, requestHandler: router, + launchContext: { + launchOptions: { + args: [ + '--disable-gpu', // Mitigates the "crashing GPU process" issue in Docker containers + ] + } + } }); // Run the crawler with the start URLs and wait for it to finish. diff --git a/templates/ts-crawlee-playwright-chrome/src/main.ts b/templates/ts-crawlee-playwright-chrome/src/main.ts index f5ef6e0b..4d536208 100644 --- a/templates/ts-crawlee-playwright-chrome/src/main.ts +++ b/templates/ts-crawlee-playwright-chrome/src/main.ts @@ -33,6 +33,13 @@ const crawler = new PlaywrightCrawler({ proxyConfiguration, maxRequestsPerCrawl, requestHandler: router, + launchContext: { + launchOptions: { + args: [ + '--disable-gpu', // Mitigates the "crashing GPU process" issue in Docker containers + ] + } + } }); await crawler.run(startUrls); diff --git a/templates/ts-crawlee-puppeteer-chrome/src/main.ts b/templates/ts-crawlee-puppeteer-chrome/src/main.ts index 880d7831..70177502 100644 --- a/templates/ts-crawlee-puppeteer-chrome/src/main.ts +++ b/templates/ts-crawlee-puppeteer-chrome/src/main.ts @@ -22,6 +22,13 @@ const proxyConfiguration = await Actor.createProxyConfiguration(); const crawler = new PuppeteerCrawler({ proxyConfiguration, requestHandler: router, + launchContext: { + launchOptions: { + args: [ + '--disable-gpu', // Mitigates the "crashing GPU process" issue in Docker containers + ] + } + } }); // Run the crawler with the start URLs and wait for it to finish.