What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Use Playwright’s page.screenshot() after launching a Chromium build that is packaged for your Lambda runtime and architecture. The screenshot can be written to a file or returned as bytes; storing it in S3 or another service is a separate step. The key deployment task is choosing and validating a compatible browser package—not the screenshot call itself.
What you need to make work in Lambda
A Lambda function needs a Chromium executable it can run, Playwright code compatible with that browser, and enough time and resources to load the target page. Pin the Playwright and browser/package versions together, and verify them against your chosen Lambda runtime and architecture before deploying. The available package documentation does not establish a currently maintained, universally compatible combination.
- Browser: bundle or otherwise provide a Chromium build suitable for the execution environment.
- Launch configuration: use the selected package’s documented executable path and launch arguments.
- Capture target: decide whether you need the visible viewport, the full scrollable page, or one element.
- Output handling: choose a local file for convenient inspection or bytes for upload, transformation, or an HTTP response.
Choose and verify a Chromium packaging approach
Two package-based approaches appear in the available documentation. Neither is established here as the current winner, so treat each as a candidate to validate rather than a drop-in recommendation.
| Approach | Documented details | What to verify before relying on it |
|---|---|---|
playwright-aws-lambda with playwright-core |
The package’s npm documentation describes calling launchChromium(), creating a context and page, navigating, and closing the browser. It lists Node.js 10.x, 12.x, 14.x, 16.x, 18.x, and 20.x as working out of the box and says it supports Chromium only. Package documentation. |
Those are the package’s claims, not confirmation that AWS currently offers each runtime or that the package works with a current Playwright release. Check package activity, runtime availability, architecture, browser version, and launch behavior. |
chrome-aws-lambda paired with playwright-core |
The repository documents using its binary and launch arguments with Playwright. Its maintainers recommend at least 512 MB of memory and 1600 MB or more. Repository documentation. | The memory figures are repository recommendations, not AWS minimums or workload benchmarks. Verify that the package’s binary, executable path, launch arguments, runtime, and architecture still match your deployment. |
For either route, test the exact deployed artifact in the target Lambda environment. Compare package size, cold-start behavior, memory use, browser launch success, and screenshot output for representative pages. Do not infer compatibility from a package’s historical runtime list alone.
#1 Best Overall
Capture a screenshot with Playwright
The capture calls below are the Playwright portion of the solution. They assume you already have a compatible Chromium package and have launched a browser using its documented API. The sources do not establish one current Lambda launch recipe that is safe to present as universal.
Capture the visible viewport to a file
await page.goto('https://example.com', { waitUntil: 'domcontentloaded' });
await page.screenshot({ path: '/tmp/screenshot.png' });
In Lambda, use a path available to the function for temporary output, and do not assume a local file persists after the invocation. The path form is useful for inspection or for code that will read the file afterward.
Capture bytes instead of writing a file
const imageBytes = await page.screenshot({ type: 'png' });
Without a path, Playwright returns image bytes. Pass those bytes to your storage client or response handler. Returning bytes from Playwright does not itself upload them to S3.
Capture the full page or one element
const fullPageBytes = await page.screenshot({ type: 'png', fullPage: true });
const elementBytes = await page.locator('#report').screenshot({ type: 'png' });
fullPage: true captures the full scrollable document. A locator screenshot targets a particular element. Choose deliberately: full-page captures can be much larger and may expose content that is not visible in the initial viewport.
Wait for the page you actually need
There is no universal delay that guarantees a page is ready. A fixed sleep can waste Lambda time on fast pages and still capture an incomplete page on slow ones. Wait for an application-specific condition where possible, such as a locator appearing or a known loading state disappearing. Select a navigation wait condition appropriate to the site; the examples use domcontentloaded, which is not a guarantee that client-rendered content or images have finished loading.
For visual comparisons, environment differences matter: Playwright notes that rendering can vary with operating system, browser version, settings, hardware, power source, and headless mode. When comparing screenshots, generate the baseline and new capture in the same environment whenever possible. Playwright visual comparison documentation.
Persist or return the result
If the caller needs the artifact after the invocation, explicitly upload the bytes or file to a destination such as S3, or return the bytes through your application’s response path. A screenshot buffer is only an in-memory result; persistence and access control are your application’s responsibility. AWS’s screenshot-processing architecture illustrates Lambda and S3 as parts of a larger pipeline, but does not prescribe this Playwright implementation. AWS Serverless Image Handler architecture.
Close the browser on success and failure
Close the browser in cleanup logic so an exception during navigation or capture does not skip cleanup. The Lambda package example demonstrates closing the browser after work. Package example.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitcheslet browser;
try {
// Launch Chromium using the API and options documented by your chosen package.
browser = await launchYourCompatibleChromium();
const context = await browser.newContext();
const page = await context.newPage();
await page.goto('https://example.com', { waitUntil: 'domcontentloaded' });
const imageBytes = await page.screenshot({ type: 'png' });
// Upload imageBytes or return it through your handler.
} finally {
if (browser) await browser.close();
}
launchYourCompatibleChromium() is intentionally illustrative, not a real package API. Replace it with the launch method, executable path, and arguments documented by the package and version you have verified.
Rank #4
Memory, performance, and reliability
- Memory: page complexity, image loading, full-page capture, and browser overhead all affect resource needs. The
chrome-aws-lambdamaintainers’ 512 MB minimum and 1600 MB-or-more recommendation are package-specific guidance, not general Lambda requirements. - Cold starts and deployment size: a bundled browser increases the artifact you deploy and can affect startup. Measure the exact package and function in your target configuration rather than extrapolating from a local run.
- Timeouts: navigation, client-side rendering, and screenshot processing all use the invocation’s time. Set timeouts based on your workload and handle navigation or capture failures rather than treating every page as successful.
- Output size: full-page captures and high-resolution pages can produce larger images than viewport captures. Consider whether a viewport or element capture satisfies the use case.
- Visual consistency: keep browser and runtime conditions aligned across baseline and comparison captures; different environments can render pages differently.
Security when the URL comes from a caller
A caller-supplied URL should not be treated as safe by default. The package and screenshot API documentation cited here do not establish URL allowlisting or network-egress protections for your function. If callers control the destination, design validation and outbound network restrictions for your application before exposing the capture endpoint.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Troubleshooting common failures
- Chromium fails to launch: check that the binary exists in the deployed artifact, its executable path and launch arguments match the selected package, and the package supports the runtime and architecture you actually deploy.
- Works locally, fails in Lambda: local success does not verify the Lambda browser binary or environment. Test the exact package, runtime, architecture, and deployment artifact in Lambda.
- Blank or incomplete screenshot: the page may not have reached the application-specific ready state. Wait for a meaningful selector or page condition instead of assuming a fixed delay is sufficient.
- Screenshot is missing after the invocation: a file path or in-memory buffer is not durable storage. Upload the bytes or file to your chosen destination explicitly.
- Visual comparison differs unexpectedly: browser version, operating system, headless mode, hardware, and settings can change rendering. Align the environments used for baseline and current captures.
- Function runs out of resources or time: assess page complexity, capture scope, image size, and the configured memory and timeout. The package-specific memory suggestions are not a substitute for measuring your own workload.
Or skip the browser setup
If you need a screenshot without packaging Chromium into Lambda, ScreenshotNeo is a website screenshot API and MCP server. Its one-call API returns a screenshot or PDF for a URL:
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. Cookie banners are accepted and removed before capture, along with supported newsletter popups and chat widgets. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed. Its MCP server lets AI agents take screenshots, and the free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 screenshots.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Sign up for ScreenshotNeo free.
Frequently Asked Questions
Can Playwright return a screenshot without creating a file?
Yes. Call page.screenshot() without a path; Playwright returns image bytes.
Best Value
Does a screenshot buffer automatically get saved to S3?
No. Upload the returned bytes or a written file using your application’s storage code.
Can I use the package’s listed Node.js versions as proof AWS supports them now?
No. Those are compatibility claims in the package documentation, not confirmation of current Lambda runtime availability.
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.




