For a large Puppeteer PDF, first make the render predictable, then size AWS Lambda for the document’s measured peak memory and runtime. Use a Lambda-compatible Chromium build or container, await page readiness and every upload, and store the PDF in S3 instead of returning a large file through a synchronous response. Lambda can work well for bounded, bursty jobs; if worst-case renders approach its hard limits, use a queue-backed container worker such as ECS/Fargate.
Why large Puppeteer PDFs fail on AWS
A PDF render is a burst of work, not just a call to page.pdf(). Chromium must start, load the page and its assets, lay out and paginate the document, serialize PDF bytes, and often upload the result. Large pages, high-resolution images, complex CSS, slow external assets, or several simultaneous browser pages can push memory and duration beyond a small function’s capacity.
Lambda’s console default of 128 MB is not a sensible assumption for a substantial Chromium job. In Lambda, memory allocation also controls CPU: AWS documents that 1,769 MB corresponds to the equivalent of one vCPU. Measure peak usage and render time using representative worst-case documents, then allocate headroom for startup, asset transfer, serialization, upload, and cleanup. AWS explains that it stops an invocation when its timeout is reached in its Lambda configuration troubleshooting guide.
Know Lambda’s hard limits before choosing it
AWS lists the following Lambda quotas in its Lambda quotas documentation. These are service limits, not a promise that a particular PDF will fit or finish within them.
#1 Best Overall
- 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.
| Constraint | Published limit | Why it matters for PDFs |
|---|---|---|
| Memory allocation | 128 MB–10,240 MB | Chromium’s working set and PDF serialization need measured headroom; memory also affects CPU allocation. |
| Maximum standard invocation timeout | 900 seconds | A render and upload that cannot finish inside 15 minutes needs a different job architecture. |
| Zipped function upload | 50 MB | A browser binary and dependencies can make a traditional deployment package difficult to fit. |
| Unzipped deployment package | 250 MB | Check the expanded package size, not just the ZIP size. |
/tmp ephemeral storage |
512 MB–10,240 MB | Temporary files need enough space if you write PDFs or browser data to disk. |
| Synchronous request and response payload | 6 MB | A multi-megabyte PDF response may exceed the response quota; return a job identifier or S3 link instead. |
Lambda may still be the right choice for short, variable bursts. The important distinction is between a job that is merely large and one whose worst case is close to the invocation, package, storage, or payload ceiling. For the latter, adding retries to a synchronous request does not remove the underlying limit.
Package Chromium for the runtime you will actually use
Puppeteer’s troubleshooting documentation describes the package-size challenge on Lambda and points to compatible Chromium distributions. Choose a build intended for the Lambda runtime and architecture you deploy; ensure its required libraries and launch configuration match that environment. Do not assume the Chromium binary installed on a developer laptop will run in Lambda. Puppeteer’s troubleshooting guide also notes that Amazon Linux EC2 requires EPEL and Chromium dependencies.
A container image is another packaging model: it lets you ship Chromium and its dependencies together, subject to the service’s image and runtime constraints. Keep the browser build, Puppeteer version, operating system libraries, and deployment architecture aligned. Test the deployed artifact—not only local development—because missing shared libraries commonly appear only at launch.
Rank #2
- 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.
- Use a Lambda-compatible Chromium distribution for a ZIP-based Lambda deployment, or build a container that includes Chromium and its dependencies.
- Set the executable path and launch arguments for that build and runtime. Do not copy flags blindly between Lambda, Amazon Linux EC2, and containers; the right flags depend on the selected environment and security model.
- Package required fonts when the document depends on them, and make remote assets reachable from the runtime. A function attached to a VPC may not have the same external network access as a local workstation.
Render and upload a PDF without leaving work behind
The following Node.js example assumes you have installed puppeteer-core, an AWS SDK for JavaScript S3 client, and a Chromium build compatible with the deployed runtime. Set CHROMIUM_PATH to that build’s executable, CHROMIUM_ARGS to a JSON array of arguments required by that build, and configure the function’s AWS credentials and PDF_BUCKET. The arguments are deliberately deployment-specific rather than a universal copied flag list.
Free tools Windows power users keep installed
One-click scans. No signup required.
import puppeteer from 'puppeteer-core';
import { S3Client, PutObjectCommand } from '@aws-sdk/client-s3';
const s3 = new S3Client({});
const bucket = process.env.PDF_BUCKET;
const chromiumPath = process.env.CHROMIUM_PATH;
const chromiumArgs = JSON.parse(process.env.CHROMIUM_ARGS || '[]');
export const handler = async (event) => {
if (!bucket || !chromiumPath || !event.url) {
throw new Error('Set PDF_BUCKET and CHROMIUM_PATH and provide event.url');
}
let browser;
let page;
try {
browser = await puppeteer.launch({
executablePath: chromiumPath,
args: chromiumArgs,
headless: true
});
const context = await browser.createBrowserContext();
page = await context.newPage();
page.setDefaultNavigationTimeout(45000);
page.setDefaultTimeout(15000);
await page.goto(event.url, { waitUntil: 'domcontentloaded' });
// Prefer a page-specific readiness selector when the site provides one.
if (event.readySelector) {
await page.waitForSelector(event.readySelector);
}
await page.evaluate(async () => {
if (document.fonts?.ready) await document.fonts.ready;
await Promise.all(Array.from(document.images, (img) => {
if (img.complete) return Promise.resolve();
return new Promise((resolve) => {
img.addEventListener('load', resolve, { once: true });
img.addEventListener('error', resolve, { once: true });
});
}));
});
const pdf = await page.pdf({
format: 'A4',
printBackground: true,
preferCSSPageSize: true
});
const key = `pdf/${Date.now()}.pdf`;
await s3.send(new PutObjectCommand({
Bucket: bucket,
Key: key,
Body: pdf,
ContentType: 'application/pdf'
}));
return { bucket, key };
} finally {
if (page) await page.close().catch(() => {});
if (browser) await browser.close().catch(() => {});
}
};
This is a render-and-store pattern: the handler returns an S3 object location rather than PDF bytes. In a production job system, persist a job record and return its identifier; expose a signed download URL only through an authenticated application flow. If event.url is supplied by an untrusted caller, validate allowed destinations so the function cannot be used to fetch internal or otherwise unauthorized addresses.
Make readiness specific to the page
domcontentloaded is a useful starting point, not proof that a modern page is ready to print. Use a selector, application-provided readiness signal, or other explicit condition that means the content is complete. Waiting for network idle can be inappropriate for pages with analytics, polling, or persistent connections. The example awaits fonts and image load/error events before printing; sites with lazy-loaded images may need an intentional scroll or a page-specific trigger to load content below the fold.
Rank #3
- 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.
Choose print output deliberately
page.pdf() uses print CSS by default and returns PDF bytes, as documented in the Puppeteer Page.pdf API. If a page’s stylesheet is designed for screen display, call await page.emulateMediaType('screen') before generating the PDF. Otherwise, test and retain print media styles.
Set printBackground when background colors or images belong in the output. Use format for a chosen paper size, or match the document’s CSS page sizing with preferCSSPageSize. Margins, landscape output, and pageRanges are additional controls; select them to match the document’s CSS and product requirements rather than applying them automatically. Check page breaks, headers and footers, colors, and pagination on representative largest documents.
Await work and clean up reliably
Await navigation, readiness checks, font and asset waits, PDF generation, S3 upload, and cleanup before the handler returns. Create a browser context and page for each job, and close them in a finally path even after a navigation or upload error. Keep browser and page objects scoped so one render cannot leak state into another. Lambda warm environments may preserve globals between invocations; AWS warns that work continuing after a handler exits can produce confusing behavior. Do not launch background tasks and assume they will finish after the response.
Rank #4
- 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
Or skip the browser setup
For a straightforward capture of a public website, ScreenshotNeo offers a one-request screenshot API and MCP server. It is not a replacement for custom Puppeteer code when you need your own Chromium environment or document-specific rendering logic; its API is a simpler option when the task is capturing a URL. The request below saves a WebP capture. See the ScreenshotNeo documentation for the API options.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
- Cookie/consent banners are accepted like a visitor and more than 60 known consent platforms, newsletter popups, and chat widgets are removed before capture; each cleanup step can be turned off.
- Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed; response headers report the page verdict and billing status.
- An MCP server provides
take_screenshot,get_page_info, andcapture_pdftools for Claude, Cursor, and other MCP clients. - The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots. Every feature is on every plan.
Sign up for ScreenshotNeo’s free plan to try 1,000 screenshots a month with no card.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.When to move the job from Lambda to ECS/Fargate
| Consideration | Lambda | Queue-backed ECS/Fargate worker |
|---|---|---|
| Job duration | Fits within a maximum 900-second invocation and has tested headroom. | Better suited when worst-case jobs approach or exceed Lambda’s 15-minute ceiling. |
| Memory and CPU | Allocation is capped at 10,240 MB; memory allocation also governs CPU. | A container worker is the safer direction when the job needs more headroom or isolation than the Lambda design provides. |
| Chromium packaging | Compatible browser distributions must fit deployment constraints, or use a container image. | Package Chromium and its dependencies in the worker container. |
| Startup and operations | Attractive for bursty, short work; requires correct packaging and Lambda configuration. | Requires a queue, worker service, job-state handling, and container operations. |
| Concurrency and delivery | Keep each invocation bounded; save output to S3 instead of returning large PDF bytes synchronously. | Queue jobs, isolate worker concurrency, persist status and output in S3, and return a job ID or signed URL. |
| Cost decision | Compare measured memory and duration at expected volume, including retries and peak bursts. | Compare worker runtime and capacity at expected volume, including idle capacity and queue throughput. |
There is no universal cost winner: document volume, render duration, burst shape, and how much worker capacity must stay available all affect the comparison. Benchmark representative jobs in the deployment environment and compare expected workload costs, not a single small test render.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Best Value
- 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.
Troubleshoot the common failure modes
- Chromium fails to launch or reports missing shared libraries: use a Chromium distribution compatible with the Lambda runtime or a container that includes the required dependencies. On Amazon Linux EC2, Puppeteer’s troubleshooting guide calls out EPEL and Chromium dependencies.
Task timed outorStatus: timeout: inspect CloudWatch logs and the measured duration. Raise the timeout only within the 900-second limit, increase memory to gain CPU, reduce asset latency, and move jobs that still approach the limit to an asynchronous container worker. AWS stops the invocation when its timeout is reached.- Out of memory or browser disconnect: raise the measured memory allocation, reduce simultaneous pages, close contexts promptly, and avoid retaining multiple large HTML or PDF buffers. Check for state or browser objects retained across warm invocations.
- Truncated PDF response or API Gateway 5xx: do not send a large PDF through a synchronous Lambda response. Upload it to S3 and return a job ID or signed link; also account for request/response limits imposed by any front door.
- Fonts or images are missing: wait for the page’s readiness signal and assets, package required fonts, verify URLs are reachable from the deployed runtime, and reproduce the issue using the deployed artifact.
- Wrong colors, layout, or page count: remember that PDF output uses print media by default. Use
emulateMediaType('screen')only when screen CSS is intended, then check print-specific rules, page breaks, andpreferCSSPageSizeagainst representative documents.
Measure before increasing concurrency
Test with the largest realistic documents, including slow or failed assets, unusually long pages, and the page’s normal font and image load behavior. Record CloudWatch Max Memory Used, duration, timeouts, and error logs. Increase memory or timeout based on those measurements, while leaving room for startup, PDF serialization, S3 transfer, and cleanup. A job that barely fits in a single test can fail under a slower asset response or a larger input.
Limit simultaneous browser pages within each worker until peak memory is understood. For repeatable jobs near Lambda’s limits, put requests on a queue, have a containerized Chromium worker render each job, persist job state and output in S3, and let the caller poll status or retrieve a signed URL. This separates the caller’s response time from the time a large PDF needs to finish.
Quick Recap
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.

