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
/screenshotendpoint.
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/](https://roast-my-website.vercel.app/)Framework: Node.js/Express