From 467fdd2a6c1994ad187ba718f9b7a688d97bfbca Mon Sep 17 00:00:00 2001 From: olsch01 Date: Tue, 3 Mar 2026 11:05:53 -0500 Subject: [PATCH] fix: auto-detect system Chromium for puppeteer on Linux servers Puppeteer's bundled Chrome often fails on Linux servers due to architecture mismatches. Now auto-detects system-installed Chromium at common paths (/usr/bin/chromium-browser, /usr/bin/chromium), or honors PUPPETEER_EXECUTABLE_PATH env var. Co-Authored-By: Claude Opus 4.6 --- scripts/fetch-cd-rates.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/fetch-cd-rates.ts b/scripts/fetch-cd-rates.ts index 198b85f..0d56368 100644 --- a/scripts/fetch-cd-rates.ts +++ b/scripts/fetch-cd-rates.ts @@ -402,9 +402,20 @@ async function main() { let browser: Browser | null = null; try { + // Use system Chromium if PUPPETEER_EXECUTABLE_PATH is set, + // or auto-detect common locations on Linux servers. + const executablePath = + process.env.PUPPETEER_EXECUTABLE_PATH || + ['/usr/bin/chromium-browser', '/usr/bin/chromium', '/usr/bin/google-chrome'].find( + (p) => { try { require('fs').accessSync(p); return true; } catch { return false; } }, + ) || + undefined; + console.log('\nLaunching headless browser...'); + if (executablePath) console.log(`Using browser: ${executablePath}`); browser = await puppeteer.launch({ headless: true, + executablePath, args: [ '--no-sandbox', '--disable-setuid-sandbox',