Skip to content

Crawlee—A web scraping and browser automation library for Node.js to build reliable crawlers. In JavaScript and TypeScript. Extract data for AI, LLMs, RAG, or GPTs. Download HTML, PDF, JPG, PNG, and other files from websites. Works with Puppeteer, Playwright, Cheerio, JSDOM, and raw HTTP. Both headful and headless mode. With proxy rotation.

No sandbox argument is set only on platform (#799)

Jan Bárta0c3d415ea9c1
diff --git a/src/puppeteer.js b/src/puppeteer.js
index 834c66dda..444746301 100644
--- a/src/puppeteer.js
+++ b/src/puppeteer.js
@@ -202,7 +202,12 @@ export const launchPuppeteer = async (options = {}) => {
const optsCopy = { ...options };
optsCopy.args = optsCopy.args || [];
- optsCopy.args.push('--no-sandbox');
+ // Add --no-sandbox for Platform, because running Chrome in Docker
+ // is a very complex problem and most likely requires sys admin privileges,
+ // which is a larger security concern than --no-sandbox itself.
+ // TODO Find if the arg has any impact on browser detection.
+ if (isAtHome()) optsCopy.args.push('--no-sandbox');
+
if (optsCopy.headless == null) {
optsCopy.headless = process.env[ENV_VARS.HEADLESS] === '1' && process.env[ENV_VARS.XVFB] !== '1';
}