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:
- Deploy a Node.js 18 serverless function to Vercel with Puppeteer and
chrome-aws-lambda
as dependencies. - Attempt to launch Chromium in production using
chrome-aws-lambda
. - Observe the error related to missing libraries (
libnss3.so
).
Questions
- Does Vercel fully support
chrome-aws-lambda
and its dependencies for Node.js 18.x in serverless functions? - Are additional configurations required in
vercel.json
or elsewhere to ensure all necessary shared libraries are available? - 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