(async ()=>{ // dynamic import to support ESM-only puppeteer builds const mod = await import('puppeteer') const puppeteer = (mod && mod.default) ? mod.default : mod const chromePath = process.env.CHROME_PATH || '/usr/bin/google-chrome' const url = process.env.VITE_BROADCASTPANEL_URL || 'https://avanzacast-broadcastpanel.bfzqqk.easypanel.host' console.log('Using chromePath=', chromePath) try { const browser = await puppeteer.launch({ executablePath: chromePath, args: ['--no-sandbox','--disable-setuid-sandbox','--disable-dev-shm-usage','--headless=new'], defaultViewport: { width: 1280, height: 800 }, timeout: 20000 }) const version = await browser.version() console.log('Browser version:', version) const page = await browser.newPage() await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 20000 }) console.log('Page title:', await page.title()) await page.screenshot({ path: 'debug-chrome-screenshot.png', fullPage: true }) console.log('Screenshot saved: debug-chrome-screenshot.png') await browser.close() } catch (err) { console.error('DEBUG-CHROME ERROR:', err && err.stack ? err.stack : err) process.exit(2) } })()