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

To capture a Puppeteer screenshot on AWS Lambda, the browser, Puppeteer version, Lambda operating system and CPU architecture must be compatible—and the browser and its dependencies must fit your deployment package. For a Node.js 20-or-later Lambda container image, account for its Amazon Linux 2023 base. Then choose a browser distribution, package format and headless mode that match your function.

Check the Lambda runtime, image and architecture first

Start with the deployment environment, not a copied Chromium launch command. AWS’s Node.js container-image guidance says Node.js 20 and later images are based on Amazon Linux 2023 (AL2023). AL2023 uses microdnf or dnf, rather than yum; commands written for Amazon Linux 2 may therefore fail on a newer image.

  • Record the Lambda Node.js runtime and, for a container deployment, the base-image tag and Linux version.
  • Confirm whether the function targets x86_64 or arm64. The browser binary, native libraries and image must all match that architecture.
  • For a non-AWS or OS-only container image, include the Node.js runtime interface client as AWS requires.

AWS supports both x86_64 and arm64, but that does not certify a particular Chromium package build for either architecture. Check the selected browser project’s current documentation for supported architectures, runtime requirements and integration instructions before building.

Choose how to package Chromium

Browser binaries and system dependencies can make Puppeteer deployments too large for a ZIP package. AWS’s published Lambda limits distinguish direct ZIP uploads from container images:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
Deployment format Published size limit What to check
ZIP uploaded directly 50 MB Compare the upload archive with the direct-upload limit.
ZIP deployment contents 250 MB unzipped, including layers Check the extracted function and layer contents, not only the compressed file size.
Container image 10 GB uncompressed Account for the full image, including the runtime, browser and libraries.

For a ZIP that exceeds the direct-upload limit, AWS supports uploading it through S3. If the browser and dependencies exceed the unzipped ZIP limit, consider a container image. A container gives you more room and control over system libraries, but requires maintaining and deploying the image. A ZIP or layer may fit an existing deployment workflow better, but its size ceiling can be restrictive.

Puppeteer’s troubleshooting guidance identifies browser size as a Lambda challenge and points to the community sparticuz/chromium project as an option. Treat it as a candidate, not a universally compatible drop-in: check its current instructions for your Node.js runtime, architecture, browser version and launch configuration.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Match Puppeteer to its browser and headless mode

Puppeteer’s bundled-browser model changed across major versions. Puppeteer 20 moved its supported downloaded browser to Chrome for Testing. From Puppeteer 22, regular headless Chrome is the default; the older headless implementation is a separate chrome-headless-shell binary, selected with headless: 'shell'.

  • Use the browser version supported by the Puppeteer version you install, or verify compatibility when using a separately packaged browser.
  • Choose regular headless Chrome when you need its feature behavior. Consider headless: 'shell' only when your browser distribution supplies the shell binary and its behavior meets your needs. Puppeteer describes the shell as more performant for automation that does not need the full Chrome feature set, but it does not behave identically to regular Chrome.
  • Do not assume an older Lambda-specific Chromium package will work with a current Puppeteer release. Check both projects’ current compatibility guidance.

Build a Lambda handler around the supplied browser

There is no universal Chromium executable path or launch-flag list established for every Lambda package. The example below is a Node.js handler using puppeteer-core and an executable path supplied through PUPPETEER_EXECUTABLE_PATH. It captures a page to PNG and returns the bytes as base64 in a Lambda response. It does not install Chromium: include a compatible browser and its required operating-system libraries in the artifact or container, and set the environment variable to the path documented by that browser distribution.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
const puppeteer = require('puppeteer-core');

exports.handler = async (event) => {
  const executablePath = process.env.PUPPETEER_EXECUTABLE_PATH;
  if (!executablePath) {
    throw new Error('Set PUPPETEER_EXECUTABLE_PATH to the packaged browser executable.');
  }

  const url = event?.queryStringParameters?.url;
  if (!url) {
    return {
      statusCode: 400,
      headers: { 'content-type': 'application/json' },
      body: JSON.stringify({ error: 'Provide a url query parameter.' })
    };
  }

  let browser;
  try {
    browser = await puppeteer.launch({
      executablePath,
      headless: true
    });
    const page = await browser.newPage();
    await page.goto(url, { waitUntil: 'networkidle2' });
    const png = await page.screenshot({ type: 'png', fullPage: true });

    return {
      statusCode: 200,
      headers: { 'content-type': 'image/png' },
      isBase64Encoded: true,
      body: Buffer.from(png).toString('base64')
    };
  } finally {
    if (browser) await browser.close();
  }
};

This handler expects an invocation event with queryStringParameters.url and an integration that accepts a base64-encoded binary response. Restrict or validate the URL if the endpoint is exposed to untrusted callers; otherwise it could be used to request destinations your function can reach. The choice of networkidle2 is only a starting point: some pages keep network connections open or render important content after navigation.

The environment variable is intentionally explicit. Set it to the executable location returned or documented by the browser package you selected; do not guess a path based on a local desktop Chrome install. Likewise, add only the launch arguments that the chosen package’s current Lambda instructions require. Puppeteer’s troubleshooting notes about --no-sandbox in nearby hosting-platform examples are not a universal AWS Lambda prescription.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Wait for the content you actually need

page.goto() supports different navigation wait conditions. The example waits for networkidle2, as in Puppeteer’s screenshot guidance, but the right condition depends on the target site. A page can reach a navigation milestone before its application has rendered the content you need, while long-lived connections can prevent an idle condition from being reached.

  • For a page whose key content is rendered after navigation, wait for a meaningful selector with Puppeteer’s page wait methods before capturing.
  • For a page that never becomes network-idle, use a suitable navigation condition and wait for the specific content rather than relying on network quiet alone.
  • For a partial capture, use Puppeteer’s ElementHandle.screenshot(). For a page capture, use Page.screenshot().

Choose full-page capture only when you need the whole document; it can take more time and temporary storage than a viewport capture. If the target uses lazy-loaded images, verify that the required content has loaded before taking the screenshot.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Size memory, timeout and temporary storage from runs

AWS’s Lambda quotas set bounds, not a recommended configuration for every screenshot job. The published ranges are 128 MB to 10,240 MB of memory, a maximum timeout of 900 seconds, and configurable /tmp storage from 512 MB to 10,240 MB. Lambda’s ephemeral-storage documentation notes that /tmp is temporary and unique to each execution environment.

Browser extraction and screenshot work can use temporary storage. Measure the selected package’s extraction needs and the space used by real captures, then configure storage with room for the workload. Use observed execution duration and memory use to tune function settings; do not infer that every capture needs the maximum. A timeout can result from slow navigation, content that never reaches the chosen wait condition, or insufficient time for the browser work. Increasing the timeout alone will not resolve an incompatible browser or a page that cannot satisfy the wait condition.

Troubleshoot common launch and capture failures

Symptom Likely cause What to check or change
ZIP upload is rejected for size The archive exceeds the 50 MB direct-upload limit. Use S3 for a larger ZIP upload, or assess whether a container image is a better fit.
Deployment fails after extraction or layer expansion Unzipped deployment contents, including layers, exceed 250 MB. Inspect the extracted artifact size and remove unnecessary files, or move to a container image if appropriate.
yum is not found A recipe for Amazon Linux 2 is being used on a Node.js 20-or-later AWS image based on AL2023. Use the AL2023 package manager, microdnf or dnf, and check that required libraries are available for that image.
Executable not found The browser is absent from the deployment, or the configured path does not match the packaged executable. Inspect the built artifact and follow the selected browser package’s path instructions. Lambda has no single path that applies to every distribution.
Browser fails during startup Possible mismatch among architecture, native libraries, Puppeteer/browser versions or headless binary selection. Check those items together against the runtime and browser package documentation. Avoid copying flags from unrelated hosting platforms.
Extraction or capture runs out of space The browser extraction or workload exceeds available ephemeral storage. Inspect the package’s extraction behavior and configure /tmp based on observed usage; the default is 512 MB and the configurable maximum is 10,240 MB.
Screenshot is blank or misses content The page may not have finished navigating or rendering when the screenshot is taken. Use a wait condition suited to the site and explicitly wait for application-specific content when needed.

When an error is ambiguous, inspect the deployment artifact, executable path, architecture and shared-library requirements as one set. A browser that works on a developer’s machine is not evidence that its binary or native dependencies will work in the Lambda environment.

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server for developers. A GET request with a URL returns an image or PDF; the API example below saves a WebP. See the ScreenshotNeo API documentation for options and response details.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Cookie banners are accepted before capture, and known consent platforms, newsletter popups and chat widgets can be removed; each cleanup step can be turned off. Bot checks, blank pages, timeouts, failed loads and cache hits are not billed, and the response identifies the page verdict and billing status in headers. Its MCP server exposes take_screenshot, get_page_info and capture_pdf for AI agents. The free plan includes 1,000 screenshots a month without a card; paid plans start at $5 for 3,000 screenshots.

Sign up for ScreenshotNeo’s free plan: 1,000 screenshots a month, no card required.

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.