Skip to content

Commit

Permalink
fix: bug where sandbox is not used when in docker
Browse files Browse the repository at this point in the history
- always use 'no-sandbox'
  • Loading branch information
jaron-l committed Dec 4, 2024
1 parent 72eaa3a commit df829cd
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import puppeteer from "puppeteer-extra";
import StealthPlugin from "puppeteer-extra-plugin-stealth";
import PluginREPL from "puppeteer-extra-plugin-repl";
import { LunchMoney } from "lunch-money";
import isPi from "detect-rpi";

puppeteer.use(StealthPlugin());
puppeteer.use(PluginREPL());
Expand All @@ -28,13 +27,9 @@ async function getBrowser() {
],
};

if (isPi()) {
puppeteerOpts.executablePath = "/usr/bin/chromium";
puppeteerOpts.args!.push("--no-sandbox");
} else {
// https://stackoverflow.com/questions/74251875/puppeteer-error-an-executablepath-or-channel-must-be-specified-for-puppete
puppeteerOpts.executablePath = executablePath();
}
puppeteerOpts.args!.push("--no-sandbox");
// https://stackoverflow.com/questions/74251875/puppeteer-error-an-executablepath-or-channel-must-be-specified-for-puppete
puppeteerOpts.executablePath = executablePath();

return await puppeteer.launch(puppeteerOpts);
}
Expand Down

0 comments on commit df829cd

Please sign in to comment.