Skip to content

Instantly share code, notes, and snippets.

@waqasraza123
Created July 19, 2025 15:14
Show Gist options
  • Save waqasraza123/9bccd541cee43021b316ff34b48c7b6a to your computer and use it in GitHub Desktop.
Save waqasraza123/9bccd541cee43021b316ff34b48c7b6a to your computer and use it in GitHub Desktop.
Puppeteer on Render.com
#!/usr/bin/env bash
set -o errexit
# Install project dependencies
npm install
# Build your project (optional)
npm run build
# Install Puppeteer and download Chrome browser
npx puppeteer browsers install chrome
# Copy Chrome binary into project folder (survives deploy)
mkdir -p ./puppeteer_chrome
cp -R /opt/render/.cache/puppeteer/chrome ./puppeteer_chrome/
Render’s build environment is temporary. Chrome installed by Puppeteer gets deleted after build unless manually packaged.
This script:
Installs Puppeteer.
Downloads Chromium via Puppeteer.
Copies the browser binary into your project folder (./puppeteer_chrome), ensuring it’s available at runtime.
Usage at Runtime:
When launching Puppeteer, point to your packaged Chrome:
const browser = await puppeteer.launch({
executablePath: './puppeteer_chrome/chrome/linux-138.0.7204.94/chrome-linux64/chrome',
headless: true,
args: ['--no-sandbox', '--disable-setuid-sandbox'],
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment