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

To capture a screenshot with Playwright in AWS Lambda, deploy a Chromium binary that is compatible with your Lambda runtime and architecture, launch it with a matching Playwright setup, navigate to the page, and call page.screenshot(). The screenshot can be saved to a file or kept as bytes for an upload or response. The essential deployment work is packaging a compatible browser; the screenshot call itself is standard Playwright.

What you need to make work in Lambda

Playwright’s screenshot API does not supply a Chromium binary or configure Lambda’s execution environment for you. Your deployment must include or otherwise provide Chromium, and the browser, Playwright version, Lambda runtime, and architecture must work together. Pin compatible versions and verify that combination for your deployment rather than relying on an old package’s runtime list as a current AWS compatibility guarantee.

  • A Lambda runtime and architecture selected for your application.
  • A Chromium build and Playwright package compatible with that runtime and architecture.
  • Enough function memory and execution time for the page and browser workload.
  • A defined output destination if the screenshot must persist after the invocation.

Two package-based approaches are documented in the sources below, but the available information does not establish which is currently maintained or compatible with a particular deployment. Compare their release activity, browser provisioning and executable path, launch arguments, package size, and resource needs before choosing.

Package-based options to evaluate

  • playwright-aws-lambda documents installing with playwright-core, launching with launchChromium(), creating a context and page, navigating, and closing the browser. Its npm listing identifies version 0.11.0 and claims out-of-the-box support for Node.js 10.x, 12.x, 14.x, 16.x, 18.x, and 20.x, and says it currently supports Chromium only. Those are package claims, not confirmation that AWS still offers each runtime or that this package works with a current Playwright release.
  • chrome-aws-lambda documents pairing its Chromium binary and launch arguments with playwright-core. Its maintainers recommend at least 512 MB of memory and 1600 MB or more. These are repository recommendations, not AWS minimums or a guarantee for a given workload.

Do not copy either package’s launch setup into production without checking its current instructions and testing it against your exact Lambda runtime, architecture, and pinned Playwright version. The available evidence does not establish a maintained compatibility matrix or a winning package.

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.

Capture a page or element with Playwright

Once a compatible browser is available, the capture sequence is: launch Chromium, create a context and page, navigate, wait for the page-specific readiness condition, take the screenshot, and close the browser. The sample below shows the core flow using the playwright-aws-lambda package’s documented launch approach. Confirm the package’s current export names and launch requirements before using it; this example is not a verified deployment recipe for a current Lambda runtime.

const playwright = require('playwright-core');
const playwrightAwsLambda = require('playwright-aws-lambda');

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

  try {
    browser = await playwrightAwsLambda.launchChromium();
    const context = await browser.newContext();
    const page = await context.newPage();

    const url = event.url;
    await page.goto(url, { waitUntil: 'domcontentloaded' });

    // Replace this with a readiness condition specific to the target application.
    await page.locator('body').waitFor();

    const image = await page.screenshot({ type: 'png' });

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

The handler returns screenshot bytes as a base64-encoded response. Whether an invocation can return an image this way depends on the integration and its response limits; for larger results or a durable artifact, upload the bytes to a storage destination instead. The screenshot API does not upload to S3 automatically.

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.

Choose the capture target

  • Current viewport: Use page.screenshot() without a path to receive image bytes, or supply a path to write an image file.
  • Full scrollable page: Use page.screenshot({ fullPage: true }). Large pages can produce larger images and require more resources.
  • One element: Use a locator screenshot, for example await page.locator('#receipt').screenshot({ type: 'png' }).
  • File output: Use await page.screenshot({ path: '/tmp/screenshot.png' }) when a file is useful within the invocation. A local file does not persist as a durable artifact by itself.

Playwright documents these screenshot options in its screenshot guide. Choose an application-specific readiness condition—such as waiting for a known selector—rather than assuming a fixed delay works for every page. The available sources do not prescribe a universal wait strategy.

Persist the image beyond the invocation

When you omit path, Playwright returns image bytes. Those bytes can be passed to a storage client, transformed, or returned through an integration that accepts an image response. If you save to a path, read that file and upload it explicitly if the screenshot must be retained. Neither a returned buffer nor a local path is an S3 upload.

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.

AWS’s serverless image-processing architecture illustrates Lambda and S3 as parts of a larger image pipeline, but it does not provide a Playwright implementation. Configure storage, permissions, naming, and any response link as application logic.

Plan for deployment, rendering, and resource limits

Validate the browser deployment matrix

Before publishing a function, test the exact combination of Lambda runtime, architecture, Chromium build, Playwright version, package executable path, and launch arguments. A package’s old runtime claim is not a guarantee of availability or compatibility today. A community container-image example is not sufficiently detailed in the available sources to recommend as a specific deployment path.

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

Size memory for the workload

The 512 MB minimum and 1600 MB-or-more recommendation are figures from the chrome-aws-lambda repository, not AWS requirements. Actual use depends on the page, number of concurrent browser tasks, and capture type. Full-page images and complex pages can need more resources than a simple viewport capture. Measure your own workload and adjust function memory and timeout accordingly.

Keep visual comparisons in one environment

Playwright notes that rendering can vary with operating system, browser version, settings, hardware, power source, and headless mode. For visual regression comparisons, generate the baseline and new screenshot in the same environment where practical; a difference between a local screenshot and Lambda output may reflect the rendering environment rather than a page change.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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.

Validate URLs supplied by callers

If the function accepts a URL from an event or API caller, do not assume arbitrary URL capture is safe by default. The sources available here do not specify an allowlist or network egress design. Decide which destinations the function may reach and validate input accordingly before exposing it to untrusted callers.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common failures

  • Chromium will not launch: Check that the browser binary exists in the deployed artifact, that its architecture matches the function, and that the selected package’s executable path and launch arguments match its current instructions.
  • The package lists a runtime that Lambda does not offer: Treat the package’s compatibility list as its own claim, not AWS availability information. Choose a currently available Lambda runtime and verify the complete browser and Playwright combination before deployment.
  • Navigation succeeds but the screenshot is blank or incomplete: The page may not have reached the state you need. Wait for an application-specific selector or other meaningful readiness condition instead of relying on an arbitrary fixed delay.
  • The function runs out of memory or time: Review page complexity, full-page capture, and browser workload; then measure with suitable memory and timeout settings. The repository’s memory figures are recommendations only, not universal sizing guidance.
  • The image disappears after the function returns: A local file or in-memory buffer is not durable storage. Upload the result to your chosen destination during the invocation or return it through a suitable response integration.
  • Local and Lambda images differ: Compare browser versions, operating system, settings, and headless environment. Playwright documents that rendering can vary across environments.
  • The browser remains open after an error: Put browser closure in a finally block so cleanup runs on both success and failure.

Or skip the browser setup

If your goal is to get a screenshot from a URL rather than operate Chromium in Lambda, ScreenshotNeo provides a website screenshot API and MCP server. One GET request returns an image or PDF. See the ScreenshotNeo API documentation for request options.

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

ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before the shot; bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000.

Sign up free for ScreenshotNeo.

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.

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