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',