iulianm
iulianm

Reputation: 1

NestJs Puppeteer doesn't work on docker with Alpine Linux (in AWS)

const browser = await puppeteer.launch({
                executablePath: process.env.PUPPETEER_EXECUTABLE_PATH,
                args: ['--no-sandbox', '--disable-setuid-sandbox'],
            });
            const page = await browser.newPage();

I'm using this in a NestJs service, I have configured PUPPETEER_EXECUTABLE_PATH: /usr/bin/chromium-browser in AWS configuration and I have an error: Failed to generate PDF: Browser was not found at the configured executablePath (/usr/bin/chromium-browser). The build is done through a gitlab pipeline in which I installed everything (i hope):

- echo "Starting image provisioning... Installing prerequisites --> aws-cli, nodejs, npm"
    # Install aws CLI, NodeJS and npm
    - apk add --no-cache aws-cli nodejs npm
    - apk update
    - apk add --no-cache chromium nss freetype harfbuzz ca-certificates -ttf-freefont
    - chromium --version
    - which chromium-browser

which chromium-browser gives the output: /usr/bin/chromium-browser chromium --version gives the output: `Chromium 131.0.6778.85 Alpine Linux

I tried every solution I could found and still I have the same error as above mentioned. Tried with PUPPETEER_EXECUTABLE_PATH: /usr/bin/chromium-browser and PUPPETEER_EXECUTABLE_PATH: /usr/bin/chromium

Tried with headless: true on puppeteer.launch()

Upvotes: 0

Views: 30

Answers (0)

Related Questions