Issue with Puppeteer and chrome-aws-lambda on Node.js 18 in Vercel

Current vs Expected Behavior

Current Behavior:
When launching Puppeteer with chrome-aws-lambda in a Vercel serverless function (Node.js 18), I receive the following error:

Error: Failed to launch the browser process!
/tmp/chromium: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory

Expected Behavior:
Chromium should launch successfully using the chrome-aws-lambda configuration, as it does in local development and other serverless environments (e.g., AWS Lambda).

Code, Configuration, and Steps to Reproduce

Code:
Here’s a snippet of how Puppeteer is configured:
const chromium = require(‘chrome-aws-lambda’);
const puppeteer = require(‘puppeteer-core’);

const browser = await puppeteer.launch({
args: chromium.args,
executablePath: await chromium.executablePath,
headless: chromium.headless,
});

Dependencies (from package.json):
“dependencies”: {
“chrome-aws-lambda”: “^10.1.0”,
“puppeteer-core”: “^10.4.0”
}

Vercel Configuration (vercel.json):
{
“functions”: {
“api/**/*.js”: {
“memory”: 1024,
“maxDuration”: 10
}
}
}

Steps to Reproduce:

  1. Deploy a Node.js 18 serverless function to Vercel with Puppeteer and chrome-aws-lambda as dependencies.
  2. Attempt to launch Chromium in production using chrome-aws-lambda.
  3. Observe the error related to missing libraries (libnss3.so).

Questions

  1. Does Vercel fully support chrome-aws-lambda and its dependencies for Node.js 18.x in serverless functions?
  2. Are additional configurations required in vercel.json or elsewhere to ensure all necessary shared libraries are available?
  3. Is this a known limitation, and if so, what is the recommended approach for running Puppeteer on Vercel?

Thank you for your assistance!

Joás Ramos

Chromium does tend to have issues in a serverless environment. Sometimes updating packages or using a different Node version can help.

We have an example using Playwright with Vercel Serverless Functions that you can use as a reference: GitHub - vercel-support/00243608-nextjs-playwright

Someone else recently solved a Playwright issue in their project by switching to a different automated solution: Libnss3.so missing in Node 22.x - #4 by zetxek

I hope that helps!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.