diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fb0b693..4419a2b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: - uses: actions/checkout@v3 - uses: volta-cli/action@v1 with: - node-version: 18.x + node-version: 20.x yarn-version: 1.x - name: Install Dependencies run: yarn install diff --git a/package.json b/package.json index 15d7c39..3769076 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "access": "public" }, "volta": { - "node": "18.16.0", + "node": "20.9.0", "yarn": "3.6.4" } } diff --git a/src/services/pdf-generation.ts b/src/services/pdf-generation.ts index d105294..f40199f 100644 --- a/src/services/pdf-generation.ts +++ b/src/services/pdf-generation.ts @@ -1,3 +1,4 @@ +import { executablePath } from 'puppeteer'; import puppeteer, { PDFOptions } from 'puppeteer-core'; import report from 'puppeteer-report'; @@ -41,11 +42,12 @@ export default class PdfGenerationService { } async launchBrowser(pdfGenerationRequest: PdfGenerationRequest) { - const chromiumPath = await chromium.executablePath(); + const chromiumPath = process.env.IS_LOCAL ? executablePath() : await chromium.executablePath(); const options = { - args: chromium.args, + args: process.env.IS_LOCAL ? process.env.BROWSER_ARGS?.split(',') ?? ['--no-sandbox'] : chromium.args, + defaultViewport: chromium.defaultViewport, executablePath: chromiumPath, - headless: !!process?.env?.BROWSER_HEADLESS === false ? false : true, + headless: chromium.headless as boolean, ...pdfGenerationRequest.browserOptions };