Skip to content

Commit 3c2f493

Browse files
committed
ci: disable sandbox in ci
1 parent 8f6c826 commit 3c2f493

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/utils/pdf.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,16 @@ export async function convertHtmlToPdf(
2222
debugDumpHtml: boolean = false,
2323
baseDir?: string
2424
): Promise<void> {
25+
const defaultArgs = ["--allow-file-access-from-files", "--enable-local-file-accesses"];
26+
27+
// On many CI runners (including GitHub Actions) Chromium's sandbox is not
28+
// available. Passing these flags avoids the "No usable sandbox" failure.
29+
if (process.env.CI || process.env.GITHUB_ACTIONS) {
30+
defaultArgs.push("--no-sandbox", "--disable-setuid-sandbox", "--disable-dev-shm-usage");
31+
}
32+
2533
const browser = await puppeteer.launch({
26-
args: ["--allow-file-access-from-files", "--enable-local-file-accesses"],
34+
args: defaultArgs,
2735
});
2836
const page = await browser.newPage();
2937

0 commit comments

Comments
 (0)