Skip to content

Commit 035e3d0

Browse files
authored
Add --disable-gpu in the default Chromium args (#262)
1 parent 0bc8f11 commit 035e3d0

File tree

6 files changed

+14
-12
lines changed

6 files changed

+14
-12
lines changed

default.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919
},
2020
"rendering": {
2121
"chromeBin": null,
22-
"args": [
23-
"--no-sandbox"
24-
],
22+
"args": ["--no-sandbox", "--disable-gpu"],
2523
"ignoresHttpsErrors": false,
2624

2725
"timezone": null,
@@ -42,4 +40,4 @@
4240
"verboseLogging": false,
4341
"dumpio": false
4442
}
45-
}
43+
}

dev.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@
1919
},
2020
"rendering": {
2121
"chromeBin": null,
22-
"args": [
23-
"--no-sandbox",
24-
"--disable-setuid-sandbox"
25-
],
22+
"args": ["--no-sandbox", "--disable-setuid-sandbox", "--disable-gpu"],
2623
"ignoresHttpsErrors": false,
2724

2825
"timezone": null,
@@ -43,4 +40,4 @@
4340
"verboseLogging": false,
4441
"dumpio": true
4542
}
46-
}
43+
}

devenv/docker/ha/config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"rendering": {
1111
"timezone": null,
1212
"chromeBin": null,
13+
"args": ["--no-sandbox", "--disable-gpu"],
1314
"ignoresHttpsErrors": false,
1415
"timingMetrics": true,
1516
"mode": "default",
@@ -18,4 +19,4 @@
1819
"maxConcurrency": 5
1920
}
2021
}
21-
}
22+
}

docs/remote_rendering_using_docker.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ RENDERING_DUMPIO=true
7878

7979
**Start browser with additional arguments:**
8080

81-
Additional arguments to pass to the headless browser instance. Default is `--no-sandbox`. The list of Chromium flags can be found [here](https://peter.sh/experiments/chromium-command-line-switches/). Multiple arguments is separated with comma-character.
81+
Additional arguments to pass to the headless browser instance. Defaults are `--no-sandbox,--disable-gpu`. The list of Chromium flags can be found [here](https://peter.sh/experiments/chromium-command-line-switches/) and the list of flags used as defaults by Puppeteer can be found [there](https://github.com/puppeteer/puppeteer/blob/main/src/node/Launcher.ts#L172). Multiple arguments is separated with comma-character.
8282

8383
```bash
8484
RENDERING_ARGS=--no-sandbox,--disable-setuid-sandbox,--disable-dev-shm-usage,--disable-accelerated-2d-canvas,--disable-gpu,--window-size=1280x758

src/browser/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ export function createBrowser(config: RenderingConfig, log: Logger): Browser {
1515
return new ReusableBrowser(config, log);
1616
}
1717

18+
if (!config.args.includes['--disable-gpu']) {
19+
log.warn(
20+
'using default mode without the --disable-gpu flag is not recommended as it can cause Puppeteer newPage function to freeze, leaving browsers open'
21+
);
22+
}
23+
1824
return new Browser(config, log);
1925
}
2026

src/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export interface PluginConfig {
6262

6363
const defaultRenderingConfig: RenderingConfig = {
6464
chromeBin: undefined,
65-
args: ['--no-sandbox'],
65+
args: ['--no-sandbox', '--disable-gpu'],
6666
ignoresHttpsErrors: false,
6767
timezone: undefined,
6868
acceptLanguage: undefined,

0 commit comments

Comments
 (0)