"Could not find Chromium" error on Vercel

Current Behavior: I’m deploying a Node.js/Express API to Vercel that uses capture-website (which uses Puppeteer under the hood) to generate website screenshots. The deployment is successful, but when I make a request to the screenshot endpoint, I receive a “Could not find Chromium” error. My script is functioning properly locally.

  • The error occurs when I make a POST request to the /screenshot endpoint.

The Vercel logs show the following error:

Error making capture-website call: Could not find Chromium (rev. ...). This can occur if either
 1. you did not perform an installation before running the script (e.g. `npm install`) or
 2. your cache path is incorrectly configured (which is: /home/sbx_user1051/.cache/puppeteer).
For (2), check out our guide on configuring puppeteer at https://pptr.dev/guides/configuration.```


Relevant code:

const captureWebsite = require(‘capture-website’);

async function getScreenshot(url) {
try {
const base64Image = await captureWebsite.base64(url, {
fullPage: true,
disableAnimations: true,
});
return base64Image;
} catch (error) {
console.error(“Error making capture-website call:”, error.message);
throw new Error(“Failed to capture screenshot with capture-website.”);
}
}```

My package.json dependencies:

"dependencies": {
    "axios": "^1.6.8",
    "capture-website": "^3.1.0",
    "dotenv": "^16.4.5",
    "express": "^4.18.3",
    "nodemailer": "^6.9.15",
    "openai": "^4.38.2",
    "validator": "^13.12.0",
    "puppeteer": "^23.10.4"
  },```

Project URL: https://roast-my-website.vercel.app/
Framework: Node.js/Express

If you’re having trouble deploying an Express app, this guide can help.

You can also ask v0 for suggestions tailored to your own project setup.

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