Skip to content
Discussion options

You must be logged in to vote

The issue is that standard Puppeteer tries to download Chromium at runtime, but Vercel's serverless environment is read-only.

To fix this, you need to use @sparticuz/chromium alongside puppeteer-core.

  1. Install dependencies:

bash
npm install @sparticuz/chromium puppeteer-core
2. Update your code to use the bundled Chromium:

js
import chromium from "@sparticuz/chromium";
import puppeteer from "puppeteer-core";
export default async function handler(req, res) {
const browser = await puppeteer.launch({
args: chromium.args,
defaultViewport: chromium.defaultViewport,
executablePath: await chromium.executablePath(),
headless: chromium.headless,
});
const page = await browser.newPage();
// Genera…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by rohan0maske-sys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants