Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Run Puppeteer inside a Node.js Netlify Function and deploy a compatible Chromium executable with it. A practical serverless setup uses puppeteer-core with @sparticuz/chromium, explicitly passing the executable path and launch arguments provided by the Chromium package. Then test the deployed function—not just local Chrome—because the production runtime and browser bundle can differ from your development machine.

What you need to run Puppeteer on Netlify

  • A Node.js Netlify Function to run the browser automation.
  • Puppeteer plus a Chromium executable that works in the deployed Linux environment.
  • A deployment bundle containing the function’s runtime dependencies and browser assets.
  • A workload that fits the function’s memory, execution-time, and package-size constraints.

Netlify’s browser-prerendering example uses Puppeteer in a Serverless Function with @sparticuz/chromium. Netlify’s browser-prerendering guide documents that pattern. Netlify Functions run in an ephemeral runtime, so do not assume files written during one invocation will remain available to a later invocation. Netlify Functions overview

Choose and configure the browser

Use a separately supplied serverless Chromium

With puppeteer-core, you supply the browser yourself. The @sparticuz/chromium package provides a Linux-oriented Chromium build for serverless use; configure Puppeteer with the package’s executable path and launch arguments rather than assuming a local Chrome installation exists. Follow the package’s current README for its exact API and supported options. @sparticuz/chromium documentation

Puppeteer is designed to work with a corresponding browser version. Check compatibility before choosing or upgrading the Chromium package, and pin the dependencies in your lockfile. Puppeteer’s launch documentation explains how to pass executablePath when the browser is managed separately. Puppeteer launch options

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall

Use full Puppeteer only if its browser is in the deployed artifact

Installing puppeteer can download its preferred browser, but that does not guarantee the browser will be present in the deployed function. Verify that both the package dependencies and downloaded browser are included in the artifact Netlify executes. Do not treat a successful install as proof that production can launch Chromium.

Account for local operating systems

The serverless Chromium build is Linux-only according to its project documentation. On macOS or Windows, use a locally installed browser for local development and the serverless executable in the deployed environment, following the package’s development guidance. A local run with Chrome is useful for debugging your code but does not verify the production binary.

Rank #2
Dell Latitude 3190 11.6" HD 2-in-1 Touchscreen Laptop Intel N5030 1.1Ghz 4GB Ram 128GB SSD Windows 11 Professional (Renewed)
  • 1.1 GHz (boost up to 2.4GHz) Intel Celeron N5030 Quad-Core
  • 4GB DDR4 System Memory; 128GB Solid State Drive
  • 11.6" HD (1366 x 768) Multi-Touch Display
  • Combo headphone/microphone jack - Noble Wedge Lock slot - HDMI; 2 USB 3.1 Gen 1
  • Windows 11 Pro

Create the Netlify Function

Netlify’s default functions directory is netlify/functions/; a function named capture.js is normally invoked at /.netlify/functions/capture. If your project configures a different functions directory, put the file there instead. Netlify function directory documentation

The following CommonJS example shows the launch pattern. Check the current @sparticuz/chromium README for the package’s API and adapt the import or invocation if its version differs. Install and package compatible versions of puppeteer-core and @sparticuz/chromium with your function.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Dell Latitude 5420 14" FHD Business Laptop Computer, Intel Quad-Core i5-1145G7, 16GB DDR4 RAM, 256GB SSD, Camera, HDMI, Windows 11 Pro (Renewed)
  • 256 GB SSD of storage.
  • Multitasking is easy with 16GB of RAM
  • Equipped with a blazing fast Core i5 2.00 GHz processor.
const puppeteer = require("puppeteer-core");
const chromium = require("@sparticuz/chromium");

exports.handler = async () => {
  let browser;

  try {
    browser = await puppeteer.launch({
      args: chromium.args,
      executablePath: await chromium.executablePath(),
      headless: chromium.headless,
    });

    const page = await browser.newPage();
    await page.goto("https://example.com", { waitUntil: "networkidle2" });
    const screenshot = await page.screenshot({ type: "png" });

    return {
      statusCode: 200,
      headers: { "content-type": "image/png" },
      body: Buffer.from(screenshot).toString("base64"),
      isBase64Encoded: true,
    };
  } catch (error) {
    console.error("Puppeteer capture failed:", error);
    return {
      statusCode: 500,
      body: "Screenshot capture failed",
    };
  } finally {
    if (browser) await browser.close();
  }
};

This returns a PNG response rather than persisting a file in the ephemeral function environment. For a real endpoint, validate or constrain any URL supplied by a caller; blindly navigating to user-provided addresses can expose internal network resources or consume the function’s time and memory.

Make sure Netlify deploys the dependencies

Netlify’s CLI documentation warns that dependencies in separate, unbundled function folders are not recursively installed by the build system. Its documented options include installing them during deployment with a prebuild or postinstall script. Confirm where your dependencies live and what your bundler includes; the important result is that Puppeteer, Chromium, and their required files exist in the deployed function artifact. Netlify dependency management

Rank #4
15.6 Inch Laptop Computer, N4020, 4GB DDR4 RAM, 128GB eMMC,with Windows 11
  • EFFORTLESS EVERYDAY PERFORMANCE: Powered by Intel Celeron N4020 processor and Windows 11 Home system, delivering reliable, low-power efficiency for daily tasks like document editing, email, online classes, and web browsing
  • 15.6-INCH FULL HD DISPLAY: Enjoy immersive visuals on the 15.6" FHD (1920x1080) anti-glare screen with micro-edge bezels. Delivers clear details and comfortable viewing for long study sessions, working on spreadsheets, and video playback
  • RESPONSIVE MULTITASKING & STORAGE: Built with 4GB LPDDR4 RAM and 128GB eMMC storage for smooth daily essential use. Expand your storage by up to 1TB via the integrated TF card slot to easily store movies, photos, and working files
  • ADVANCED CONNECTIVITY: Outfitted with 2x Full-Featured Type-C ports for data transfer, fast charging, and dual-monitor output, alongside 2x USB 3.2 Gen1 ports and a 3.5mm audio jack for complete peripheral compatibility
  • LIGHTWEIGHT & SILENT OPERATION: Slim and portable for effortless travel or commuting. Features a 1MP HD webcam for remote meetings, 38Wh battery with 45W Type-C fast charging, and a fanless silent design for peaceful work environments.

The Chromium project’s README says its compressed bundle is over 50 MB and describes @sparticuz/chromium-min with a separately hosted pack for environments with size constraints. This is package-specific guidance, not a guarantee about your final deployment size: inspect the current package and verify Netlify’s applicable limits for your project. Chromium package guidance

Test locally, then test the deployed function

  1. Run the site and function locally with Netlify Dev or the local functions server. For local development on macOS or Windows, configure Puppeteer to use a locally installed browser as described by the Chromium package.
  2. Call the local function URL and check the HTTP status, response content type, and returned image. Exercise a representative page and the slow or large cases your application will handle.
  3. Deploy the site and invoke the actual function URL, typically /.netlify/functions/capture. Verify the production output; the deployed runtime uses its own Linux environment and packaged Chromium.
  4. If it fails, inspect function logs and metrics in Netlify. Separate launch failures from navigation timeouts, response construction problems, and resource-limit failures.

Netlify documents functions as ephemeral and provides local-development and monitoring guidance; those checks are important because local browser availability is not the same as a valid deployed artifact. Function overview · Function monitoring

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Sale
15.6 Inch Win 11 Laptop Computer, N4020, 4GB DDR4 RAM, 128GB Storage
  • WINDOWS 11 | STABLE PERFORMANCE: Powered by Intel Celeron N4020 processor and Windows 11 system, this laptop delivers stable performance for everyday computing tasks. It supports web browsing, online learning, document editing, email communication, and basic office work with optimized power efficiency, providing a practical and reliable experience for essential daily use for daily use.
  • 15.6” FHD IPS DISPLAY: Features a 15.6-inch Full HD IPS display with narrow bezels, offering wider viewing angles and clearer image details compared to standard panels. The improved screen-to-body ratio enhances visual experience for study, reading, document work, and video playback, making it suitable for both productivity and entertainment use.
  • 4GB DDR4 + 128GB eMMC STORAGE: Equipped with 4GB DDR4 memory and 128GB eMMC storage for everyday basics such as browsing, documents, email, and online learning platforms. The built-in TF card slot supports storage expansion up to 1TB, giving you more flexibility for files, photos, videos, and daily documents. TF card not included.
  • CONNECTIVITY & PORTS: Includes 1× TF card slot, 2× USB 3.2 Gen1 ports, and 2× full-featured Type-C ports (USB 3.2 Gen1). The Type-C ports support data transfer, charging, and video output, enabling flexible connection with external devices such as monitors, storage, and peripherals for daily work and study use.
  • LIGHTWEIGHT DESIGN | ONLINE COMMUNICATION: Designed with a slim, portable profile, this laptop is easy to carry for school, commuting, and travel. A built-in 1MP front camera supports online classes, video meetings, remote communication, and everyday conferencing. The 3300mAh battery works with the low-power system design to support practical daily use, while thermal optimization helps maintain quieter operation during extended tasks.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Check execution and memory limits

Netlify’s current configuration documentation lists a 1024 MB default function memory allocation and a 60-second synchronous execution limit. The memory allocation is configurable; the cited documentation says the synchronous execution limit is not configurable. These are documented defaults, not a promise that every account or project uses unchanged settings, so confirm your current configuration before relying on them. Large pages, slow navigation, or PDF generation can exceed the practical time or memory available to a synchronous capture. Netlify configuration documentation

Troubleshoot common failures

Function starts but Chromium cannot launch

  • Likely cause: the executable was not included, the configured path is wrong, or the browser build is incompatible with the Puppeteer version.
  • Fix: confirm the deployed artifact contains the browser and runtime dependencies; use the Chromium package’s executable path and launch arguments; check the package’s compatibility guidance and pin matching versions.

It works locally but fails after deployment

  • Likely cause: local Chrome is available on the development machine, but the deployed Linux function does not have the same browser or dependency bundle.
  • Fix: test through Netlify Dev, then call the deployed function and inspect its logs. Ensure the serverless Chromium binary and dependencies are actually packaged.

Build succeeds but the function reports a missing module

  • Likely cause: dependencies in a separate, unbundled function directory were not installed or included.
  • Fix: follow Netlify’s dependency guidance, including a deployment-time prebuild or postinstall install where appropriate, then verify the resulting artifact.

Deployment or function size becomes a problem

  • Likely cause: the Chromium bundle and other function assets make the artifact too large for the applicable limits.
  • Fix: inspect the current artifact size and platform constraints. The Chromium project documents @sparticuz/chromium-min as an option using a separately hosted pack; validate that arrangement against your deployment environment.

Navigation or PDF generation times out

  • Likely cause: the page or workload takes longer or requires more memory than the synchronous function can provide.
  • Fix: measure with representative pages, avoid waiting for more page activity than the task needs, reduce the work per invocation, and check the current function configuration and limits before using a synchronous function for large captures.

Or skip the browser setup

If you need a screenshot endpoint rather than browser infrastructure to maintain, ScreenshotNeo returns a screenshot or PDF from a single GET request. Cookie banners, popups, and chat widgets are removed before capture; bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots, and 1,000 screenshots a month are free with no card; paid plans start at $5 for 3,000.

cURL:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

See the ScreenshotNeo API documentation for request options. Sign up free for 1,000 screenshots a month, with no card required.

Frequently Asked Questions

Does Puppeteer run directly in a Netlify Function?

Yes. Run it in a Node.js Netlify Function and include a compatible Chromium executable in the deployed environment.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Can I use this setup from a macOS or Windows development machine?

Yes. Use a locally installed browser for local development and the serverless Chromium build for the deployed Linux function.

Quick Recap

Bestseller No. 1
HP 14' HD Laptop, Windows 11, Intel Celeron Dual-Core Processor Up to 2.60GHz, 4GB RAM, 64GB SSD, Webcam, Dale Pink (Renewed)
HP 14" HD Laptop, Windows 11, Intel Celeron Dual-Core Processor Up to 2.60GHz, 4GB RAM, 64GB SSD, Webcam, Dale Pink (Renewed)
14" diagonal, 1366x768 resolution, HD BrightView LED, Glossy NON-TOUCH Display
$249.99
Bestseller No. 2
Dell Latitude 3190 11.6' HD 2-in-1 Touchscreen Laptop Intel N5030 1.1Ghz 4GB Ram 128GB SSD Windows 11 Professional (Renewed)
Dell Latitude 3190 11.6" HD 2-in-1 Touchscreen Laptop Intel N5030 1.1Ghz 4GB Ram 128GB SSD Windows 11 Professional (Renewed)
1.1 GHz (boost up to 2.4GHz) Intel Celeron N5030 Quad-Core; 4GB DDR4 System Memory; 128GB Solid State Drive
$179.99
Bestseller No. 3
Dell Latitude 5420 14' FHD Business Laptop Computer, Intel Quad-Core i5-1145G7, 16GB DDR4 RAM, 256GB SSD, Camera, HDMI, Windows 11 Pro (Renewed)
Dell Latitude 5420 14" FHD Business Laptop Computer, Intel Quad-Core i5-1145G7, 16GB DDR4 RAM, 256GB SSD, Camera, HDMI, Windows 11 Pro (Renewed)
256 GB SSD of storage.; Multitasking is easy with 16GB of RAM; Equipped with a blazing fast Core i5 2.00 GHz processor.
$289.99

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.