diff --git a/src/server/utils/screenshot/lighthouse.ts b/src/server/utils/screenshot/lighthouse.ts index 5a44b5f..560fc60 100644 --- a/src/server/utils/screenshot/lighthouse.ts +++ b/src/server/utils/screenshot/lighthouse.ts @@ -1,13 +1,18 @@ import puppeteer from 'puppeteer'; import lighthouse, { Result, generateReport } from 'lighthouse'; +import { logger } from '../logger.js'; +import { env } from '../env.js'; export async function generateLighthouse(url: string): Promise { + logger.info('[Lighthouse] Generating Lighthouse report...', { url }); + // Use Puppeteer to launch headless Chrome // - Omit `--enable-automation` (See https://github.com/GoogleChrome/lighthouse/issues/12988) // - Don't use 800x600 default viewport const browser = await puppeteer.launch({ // Set to false if you want to see the script in action. - headless: 'new', + executablePath: env.puppeteerExecutablePath, + headless: true, args: ['--no-sandbox', '--single-process', '--disable-dev-shm-usage'], defaultViewport: null, ignoreDefaultArgs: ['--enable-automation'], diff --git a/src/server/utils/screenshot/website.ts b/src/server/utils/screenshot/website.ts index 97689fc..66a0fb3 100644 --- a/src/server/utils/screenshot/website.ts +++ b/src/server/utils/screenshot/website.ts @@ -12,7 +12,7 @@ export async function screenshotWebsiteDetailImage( ) { const browser = await puppeteer.launch({ executablePath: env.puppeteerExecutablePath, - headless: 'new', + headless: true, }); const page = await browser.newPage(); try {