Docker Container Cannot Locate Chrome Browser for Puppeteer Application

I’m working on a NestJS app that uses Puppeteer for PDF generation, and I’m having trouble getting it to work inside a Docker container.

The main issue is that Chrome browser cannot be found at the expected location. Here’s the error I keep getting:

Error: Browser was not found at the configured executablePath (/usr/bin/google-chrome-stable)
throw new Error(`Browser was not found at the configured executablePath (${launchArgs.executablePath})`);

I’ve tried several approaches including using the official Puppeteer Docker image, installing Chrome manually in the container, and switching to puppeteer-core, but nothing seems to work. The error message always points to the same Chrome path even when I try to modify the executablePath.

Here’s my current Docker setup:

# Using official Puppeteer image
FROM ghcr.io/puppeteer/puppeteer:23.3.0

# Set working directory
WORKDIR /app

# Copy package files
COPY package*.json ./

# Install dependencies
RUN npm install

# Copy source code
COPY . .

EXPOSE 4001
CMD ["npm", "run", "start:prod"]

And here’s how I’m configuring the browser in my service:

async onModuleInit() {
  const launchOptions = {
    headless: true,
    args: ['--no-sandbox', '--disable-setuid-sandbox'],
    browser: 'chrome',
  } as puppeteer.PuppeteerLaunchOptions;

  if (this.environment !== 'development') {
    launchOptions.executablePath = '/usr/bin/google-chrome-stable)';
  }

  this.browserInstance = await puppeteer.launch(launchOptions);
  this.currentPage = await this.browserInstance.newPage();
  this.currentPage.setDefaultTimeout(0);
  this.currentPage.setDefaultNavigationTimeout(0);
}

Using Puppeteer version 23.3.0. Any suggestions on how to properly configure Chrome in the Docker environment would be really helpful!

spotted a typo in your executablePath - you have an extra closing parenthesis there /usr/bin/google-chrome-stable) should be without it. also try removing the executablePath entirely when using the official puppeteer image, it should find chrome automatically since its already bundled in that image.

The issue is likely that you’re overriding the executablePath when using the official Puppeteer image. That image comes with Chromium pre-installed, not Chrome, so your hardcoded path to google-chrome-stable won’t work. Remove the executablePath setting completely when running in the container - Puppeteer will automatically detect the bundled Chromium binary. If you need to keep environment-specific logic, check if you’re in a container environment instead of just checking for non-development. The official image handles all the Chrome setup for you, so let it do its job rather than trying to point it elsewhere.

I ran into this exact same problem a few months back. The official Puppeteer Docker image uses Chromium, not Chrome, so when you set executablePath to google-chrome-stable it fails because that binary doesn’t exist in the container. What worked for me was completely removing the executablePath configuration and letting Puppeteer use its default bundled Chromium. Also make sure you’re not accidentally forcing the executablePath in your environment detection logic - I had a similar bug where my condition was backwards and it was setting the path even in development. Try commenting out that entire executablePath line and see if it works. The official image should handle everything automatically without any manual path configuration.