I am using puppeter in my nest js application, does anyone know the solution to solve this problem? It occurs an error when running generate pdf on OKD server but on my windows, and I also use docker when running it it works.
Failed to launch the browser process!\nchrome_crashpad_handler: --database is required\nTry 'chrome_crashpad_handler --help' for more information.\n\n\nTROUBLESHOOTING: https://pptr.dev/troubleshooting\n
# Use a Node.js base image
FROM node:18-alpine
# Install additional dependencies needed for Chrome
RUN apk update && apk add --no-cache \
chromium \
nss \
freetype \
harfbuzz \
ca-certificates \
ttf-freefont
# Set environment variable PATH for Node.js
ENV PATH="/app/node_modules/.bin:${PATH}"
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
ENV XDG_CONFIG_HOME=/tmp/.chromium
ENV XDG_CACHE_HOME=/tmp/.chromium
ENV CHROME_BIN="/usr/bin/chromium-browser"
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD="true"
# Set the working directory in the container to /app
WORKDIR /app
# Copy the package.json and package-lock.json files into the container
COPY package*.json ./
RUN mkdir -vp ./uploads
RUN mkdir -vp ./tmp
RUN chmod -R g+rwX ./tmp/
# Install the dependencies
RUN npm install
# Copy the rest of the application code into the container
COPY . .
# Build the NestJS application for production
RUN npm run build
# Expose the port that the application listens on
EXPOSE 3000
# Start the application
CMD ["node", "dist/main"]
I'm using the puppeter version "puppeteer": "^21.7.0",
this is my puppeter launch configuration code
const browser = await puppeteer.launch({
headless: 'new',
args: ['--no-sandbox', '--disable-setuid-sandbox'],
});
const page = await browser.newPage();