Vercel was built for fast, lightweight deployments. Headless browsers are the opposite of that. ScreenshotRun gives your Vercel project a vercel screenshot api endpoint through a plain fetch() call — Serverless Function, Edge Function, Cron Job, doesn't matter. The rendering happens on our Chromium fleet, not inside your function. Your bundle stays tiny, cold starts stay fast, and you never touch a browser binary.
For Next.js-specific patterns like Route Handlers and Server Components, see our Next.js integration guide.
Why Puppeteer Fails on Vercel
Vercel's Serverless Functions have a 250MB unzipped size limit. Chromium alone weighs around 300MB. That single constraint blocks most browser-based screenshot solutions before they even start. But size is only the first problem.
Cold starts add 3-5 seconds when spinning up a function that loads Chromium into memory. The filesystem is read-only, so you cannot write temporary files or cache browser profiles. And Edge Functions (Vercel's fastest runtime) run on V8 isolates with no access to native binaries at all. Running a browser there is physically impossible.
Vercel addresses this directly in their documentation: they do not recommend running Puppeteer inside Serverless Functions. The platform was designed for lightweight compute, not for launching full browser processes. Teams that try to work around these constraints end up with fragile deployments, frequent timeouts, bloated function bundles that slow down every cold start.
A vercel screenshot api approach that delegates rendering to an external service sidesteps all of these limitations. Your function stays small, boots instantly, deploys in seconds, and works on both Serverless and Edge runtimes without modification.
@vercel/og vs Screenshot API
Vercel ships @vercel/og (powered by Satori) for generating Open Graph images at the edge. It converts JSX templates into PNG images without a browser. For simple text-on-gradient cards, Satori works well. But the moment your design needs grow beyond basic layouts, you hit its rendering constraints.
| Capability | @vercel/og (Satori) | ScreenshotRun API |
|---|---|---|
| CSS Grid | Not supported | Full support |
| Pseudo-elements (::before, ::after) | Not supported | Full support |
| Box shadow | Not supported | Full support |
| CSS animations | Not supported | Renders after animation completes |
| calc(), z-index | Not supported | Full support |
| Output formats | PNG only | PNG, JPEG, WebP, AVIF, PDF |
| Live site capture | No — renders JSX template only | Yes — captures any public URL |
| JavaScript execution | None | Full browser with JS execution |
| Template maintenance | Separate JSX that drifts from live design | Captures the actual deployed page |
| Runtime | Edge (V8 isolate) | External API — callable from any runtime |
Satori is a good fit when you control the exact layout and only need simple OG cards. When you outgrow its Flexbox-only rendering, or when you need screenshots of actual web pages rather than synthetic templates, a vercel screenshot api call gives you the full browser rendering pipeline without any of the constraints.
Capture Screenshots from a Serverless Function
The most common integration pattern on Vercel is a Serverless Function that calls ScreenshotRun and returns the image. Store your API key in Vercel's Environment Variables panel under Settings, then reference it with process.env.
// api/screenshot.ts
import type { VercelRequest, VercelResponse } from '@vercel/node';
export default async function handler(
req: VercelRequest,
res: VercelResponse
) {
const { url, width, format } = req.query;
if (!url || typeof url !== 'string') {
return res.status(400).json({ error: 'Missing url parameter' });
}
const params = new URLSearchParams({
url,
format: (format as string) || 'png',
width: (width as string) || '1280',
full_page: 'true',
});
const response = await fetch(
`https://api.screenshotrun.com/v1/screenshots/capture?${params}`,
{
headers: {
Authorization: `Bearer ${process.env.SCREENSHOTRUN_API_KEY}`,
},
}
);
if (!response.ok) {
return res.status(response.status).json({
error: 'Screenshot capture failed',
status: response.status,
});
}
const imageBuffer = Buffer.from(await response.arrayBuffer());
const contentType = response.headers.get('content-type') || 'image/png';
res.setHeader('Content-Type', contentType);
res.setHeader('Cache-Control', 's-maxage=3600, stale-while-revalidate');
res.send(imageBuffer);
}
This function accepts a URL as a query parameter, forwards it to the ScreenshotRun API, and streams the image back to the client. The Cache-Control header tells Vercel's CDN to cache the response for one hour, so repeat requests for the same URL skip the API call entirely. Default timeout for Serverless Functions is 10 seconds, which is enough for most captures. If you need more time for complex pages, configure maxDuration in your vercel.json: up to 300 seconds on Hobby plans, 800 seconds on Pro.
Edge Function for Lightweight Screenshot Proxy
Edge Functions run closer to the user with millisecond startup times. No cold-start penalty. They cannot run Chromium (V8 isolates only), but they can absolutely call an external API. When you need the lowest possible latency for the routing layer itself, an Edge Function makes sense as your screenshot proxy.
// api/screenshot-edge.ts
export const config = {
runtime: 'edge',
};
export default async function handler(req: Request) {
const { searchParams } = new URL(req.url);
const url = searchParams.get('url');
if (!url) {
return new Response(JSON.stringify({ error: 'Missing url' }), {
status: 400,
headers: { 'Content-Type': 'application/json' },
});
}
const params = new URLSearchParams({
url,
format: searchParams.get('format') || 'webp',
width: searchParams.get('width') || '1280',
});
const screenshot = await fetch(
`https://api.screenshotrun.com/v1/screenshots/capture?${params}`,
{
headers: {
Authorization: `Bearer ${process.env.SCREENSHOTRUN_API_KEY}`,
},
}
);
return new Response(screenshot.body, {
status: screenshot.status,
headers: {
'Content-Type': screenshot.headers.get('content-type') || 'image/webp',
'Cache-Control': 's-maxage=3600, stale-while-revalidate=600',
},
});
}
Pick Edge when your function does nothing besides proxy the API response with no file manipulation, no heavy processing, no Node.js-specific modules. Pick Serverless when you need to write to Vercel Blob, process the image buffer, or call Node-native libraries alongside the screenshot capture.
Schedule Screenshots with Vercel Cron Jobs
Vercel Cron Jobs let you trigger Serverless Functions on a schedule, defined in vercel.json. Combine this with ScreenshotRun to capture periodic snapshots of any website: competitor pages, your own production site, client dashboards, regulatory compliance records.
{
"crons": [
{
"path": "/api/cron/capture",
"schedule": "0 */6 * * *"
}
]
}
This configuration triggers the /api/cron/capture endpoint every six hours. On Hobby plans you get two cron invocations per day, while Pro plans support up to 40 at any frequency you configure. The function itself captures the screenshot and stores it in Vercel Blob for permanent access.
// api/cron/capture.ts
import { put } from '@vercel/blob';
import type { VercelRequest, VercelResponse } from '@vercel/node';
const TARGETS = [
'https://example.com',
'https://competitor.com/pricing',
];
export default async function handler(req: VercelRequest, res: VercelResponse) {
// Verify the request comes from Vercel Cron
if (req.headers['authorization'] !== `Bearer ${process.env.CRON_SECRET}`) {
return res.status(401).json({ error: 'Unauthorized' });
}
const results = [];
const timestamp = new Date().toISOString().split('T')[0];
for (const url of TARGETS) {
const slug = new URL(url).hostname.replace(/\./g, '-');
const params = new URLSearchParams({
url,
format: 'png',
width: '1440',
full_page: 'true',
});
const response = await fetch(
`https://api.screenshotrun.com/v1/screenshots/capture?${params}`,
{
headers: {
Authorization: `Bearer ${process.env.SCREENSHOTRUN_API_KEY}`,
},
}
);
if (response.ok) {
const blob = await put(
`screenshots/${slug}/${timestamp}.png`,
response.body!,
{ access: 'public', contentType: 'image/png' }
);
results.push({ url, stored: blob.url });
}
}
res.json({ captured: results.length, results });
}
Each screenshot lands in Vercel Blob with a date-stamped path, creating a browsable archive over time. For more patterns around scheduled captures (monitoring dashboards, change detection, automated reporting), see the scheduled screenshots guide.
Screenshot on Every Deploy
Vercel fires deployment events that you can hook into for visual QA. The idea: every time your team ships a new deploy, automatically capture a screenshot of the live production URL and store it. You get a visual audit trail of what the site looked like after each release.
Set up a Deploy Hook in your Vercel project settings under Git, then point it at an endpoint that waits briefly for the deployment to propagate before capturing.
// api/deploy-screenshot.ts
import { put } from '@vercel/blob';
import type { VercelRequest, VercelResponse } from '@vercel/node';
export default async function handler(req: VercelRequest, res: VercelResponse) {
const { url: deployUrl, deploymentId } = req.body;
// Wait for deployment to be fully live
await new Promise((resolve) => setTimeout(resolve, 10000));
const targetUrl = deployUrl || process.env.PRODUCTION_URL;
const params = new URLSearchParams({
url: targetUrl,
format: 'png',
width: '1440',
full_page: 'true',
delay: '3',
});
const response = await fetch(
`https://api.screenshotrun.com/v1/screenshots/capture?${params}`,
{
headers: {
Authorization: `Bearer ${process.env.SCREENSHOTRUN_API_KEY}`,
},
}
);
if (!response.ok) {
return res.status(500).json({ error: 'Capture failed' });
}
const timestamp = new Date().toISOString();
const blob = await put(
`deploys/${deploymentId || timestamp}.png`,
response.body!,
{ access: 'public', contentType: 'image/png' }
);
res.json({ screenshot: blob.url, deployment: deploymentId });
}
Wire this into your CI pipeline or Slack notifications so every deploy comes with a visual snapshot. When something looks wrong after a release, you can compare the before-and-after screenshots instantly instead of relying on someone to notice the regression manually.
Store Results with Vercel Blob and KV
Vercel offers two storage primitives that pair well with screenshot workflows. Blob handles binary files (your captured images). KV gives you a fast key-value store with TTL support, ideal for caching screenshot URLs so you do not re-capture the same page repeatedly.
// lib/screenshot-cache.ts
import { kv } from '@vercel/kv';
import { put } from '@vercel/blob';
interface CachedScreenshot {
blobUrl: string;
capturedAt: string;
}
export async function getOrCaptureScreenshot(
url: string,
ttlSeconds = 3600
): Promise {
const cacheKey = `screenshot:${url}`;
// Check KV cache first
const cached = await kv.get(cacheKey);
if (cached) return cached;
// Capture fresh screenshot
const params = new URLSearchParams({
url,
format: 'webp',
width: '1280',
});
const response = await fetch(
`https://api.screenshotrun.com/v1/screenshots/capture?${params}`,
{
headers: {
Authorization: `Bearer ${process.env.SCREENSHOTRUN_API_KEY}`,
},
}
);
// Store image in Blob
const slug = new URL(url).hostname.replace(/\./g, '-');
const blob = await put(
`screenshots/${slug}-${Date.now()}.webp`,
response.body!,
{ access: 'public', contentType: 'image/webp' }
);
const result: CachedScreenshot = {
blobUrl: blob.url,
capturedAt: new Date().toISOString(),
};
// Cache in KV with TTL
await kv.set(cacheKey, result, { ex: ttlSeconds });
return result;
}
With this pattern, the first request for a given URL captures the screenshot, stores the image in Blob, saves the Blob URL in KV with a one-hour TTL. Subsequent requests during that window return the cached result without touching the API. When the TTL expires, the next request triggers a fresh capture. You control the refresh interval per URL by adjusting ttlSeconds.
Parameters for Vercel Screenshot Functions
When building your vercel screenshot api endpoints, these parameters cover the most common use cases. Pass them as query string parameters on the capture URL.
| Parameter | Type | Description |
|---|---|---|
url |
string | Target page URL to capture |
format |
string | Output format: png, jpeg, webp, avif, pdf. See image format options |
width |
integer | Viewport width in pixels (default: 1280) |
full_page |
boolean | Capture the entire scrollable page. See full-page screenshots |
dark_mode |
boolean | Enable dark mode via prefers-color-scheme. See dark mode screenshots |
delay |
integer | Wait N seconds after page load before capture |
selector |
string | Capture only a specific CSS element. See element screenshots |
block_ads |
boolean | Remove ads before capture. See ad blocking |
cache_ttl |
integer | Server-side cache duration in seconds. Pair with Vercel CDN caching for double-layer performance |
webhook_url |
string | Receive the result asynchronously via webhook. See webhook delivery |
Full parameter reference is available in the API documentation. Many parameters combine well. For example, full_page=true&block_ads=true&dark_mode=true gives you a clean, full-length dark mode capture in one request.
What Teams Build on Vercel with Screenshots
OG images beyond Satori. When @vercel/og hits its CSS limits, teams switch to capturing their actual pages. Design the OG version as a real HTML page with all the CSS features you want (grid layouts, shadows, gradients, custom fonts rendered by the browser) then let ScreenshotRun capture it. The result matches your live design pixel-for-pixel because it is your live design, not a Satori approximation.
Link preview services. SaaS products that display URL previews (project management tools, CMS platforms, social dashboards, documentation sites) use Vercel Serverless Functions as a screenshot proxy. Incoming URL goes in, thumbnail comes out. With Vercel CDN caching and KV storage, the same URL never gets captured twice within the cache window.
Post-deploy visual QA. Teams running continuous deployment on Vercel trigger a screenshot capture after every release. Compare the new screenshot against the previous one, whether manually or through an automated diff tool, to catch visual regressions before users report them. This catches CSS breaks, missing images, layout shifts, broken component imports that unit tests miss entirely.
Uptime and change monitoring. Vercel Cron Jobs combined with the vercel screenshot api create a lightweight monitoring system. Capture screenshots every few hours, store them in Blob, compare them over time. Detect when a competitor changes their pricing page, when a client's site goes down, when content changes unexpectedly.
Portfolio and gallery snapshots. Agencies that build sites for clients use scheduled captures to maintain an always-current portfolio. Every site they have deployed on Vercel gets captured weekly, and the latest screenshots feed into their marketing site. No manual updating, no stale screenshots of redesigned pages.
Start Capturing from Vercel
ScreenshotRun runs a managed Chromium fleet that handles the browser complexity so your Vercel functions stay lightweight. You get 200 free screenshots per month, sub-2-second captures on most pages, and the API works from Edge Functions, Serverless Functions, Cron Jobs. Any runtime where fetch() is available. No binaries to install, no cold-start penalty, no filesystem hacks, no timeout tuning.
FAQ#
Vercel does not recommend it. Chromium exceeds the 250MB function size limit, cold starts add 3-5 seconds, the filesystem is read-only, and Edge Functions cannot run native binaries at all. An external screenshot API like ScreenshotRun replaces Puppeteer with a single fetch() call that works on both Serverless and Edge runtimes.
@vercel/og uses Satori to render JSX templates into PNG images at the edge. It only supports Flexbox CSS — no Grid, no pseudo-elements, no animations, no box-shadow. ScreenshotRun captures pages with a full Chromium browser, supporting all CSS3 features and JavaScript execution. Use @vercel/og for simple text cards, ScreenshotRun when you need real page screenshots or complex layouts.
Yes. Edge Functions can call external APIs via fetch(). The ScreenshotRun API returns the screenshot as a binary response that you can stream directly to the client. Edge Functions offer millisecond cold starts, making them ideal as a lightweight screenshot proxy.
Configure a cron job in vercel.json that triggers a Serverless Function on your chosen schedule. The function calls the ScreenshotRun API, stores the result in Vercel Blob, and optionally sends a notification. Hobby plans support daily cron jobs, Pro plans support up to 40 at any frequency.
Two layers work well together. Set Cache-Control headers on your Serverless Function response so Vercel CDN caches the image at the edge. For application-level caching, store screenshot URLs in Vercel KV with a TTL so repeat requests return the cached result without calling the API again.
Yes. Set up a deployment webhook that triggers a Serverless Function after each deploy. The function waits briefly for the deployment to propagate, then calls ScreenshotRun to capture the live URL. Store the result in Vercel Blob to build a visual audit trail of every release.