---
title: Deploying Puppeteer with Next.js on Vercel
description: This guide covers setting up Puppeteer with Next.js on Vercel for headless browser automation, featuring a practical example for generating web page screenshots efficiently.
url: "https://vercel.com/kb/guide/deploying-puppeteer-with-nextjs-on-vercel"
published: 2025-11-03
last_updated: 2025-11-10
authors: Gabe Nuñez
install_vercel_plugin: npx plugins add vercel/vercel-plugin
---

Puppeteer is a powerful Node.js library that provides a high-level API to control headless Chrome or Chromium. It's incredibly useful for automating browser tasks like generating screenshots, creating PDFs, and scraping websites. Running Puppeteer in a serverless environment like Vercel, however, requires specific configuration to work within the platform's constraints.

This guide provides a general walkthrough for deploying a Next.js application with Puppeteer to Vercel. We will use a screenshot generator as a practical example to demonstrate the key concepts.

## Prerequisites

- A Vercel account.
  
- Node.js and npm (or a similar package manager) installed on your local machine.
  
- Basic knowledge of Next.js and TypeScript.
  

## Key Concepts for Puppeteer on Vercel

To successfully run Puppeteer in a Vercel Function, you must address the function bundle size limitation (250MB). The standard `puppeteer` package is too large. The solution involves two key packages:

- `puppeteer-core`: A lightweight version of Puppeteer that doesn't bundle its own browser.
  
- `@sparticuz/chromium-min`: A minimal, community-maintained version of Chromium that is small enough to fit within Vercel's limits.
  

## Getting Started

We've created a ready-to-use template that handles all the configuration for you:

[**Deploy the Puppeteer on Vercel Template**](/templates/template/puppeteer-on-vercel)

This template comes pre-configured with all the necessary packages and settings to run Puppeteer on Vercel.

## More Next.js guides

- [Identify users and control access in Next.js with Vercel Passport](/kb/guide/vercel-passport-nextjs): Use \`getIdentity()\` to read a visitor’s verified Vercel Passport identity in Next.js, then personalize pages, restrict routes by group, and log actions.
- [How can I use Python and JavaScript in the same application?](/kb/guide/how-to-use-python-and-javascript-in-the-same-application): Unlock the power of Python and JavaScript in your apps. Learn to integrate Flask and Next.js for dynamic frontends with AI-capable backends. Perfect for developers keen on hybrid programming.
- [Using xmcp with Next.js](/kb/guide/using-xmcp-with-nextjs): Add an MCP server to an existing Next.js app with xmcp. Create typed tools, add authentication, and deploy to Vercel as a Vercel Function.