Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemsIf chromium.puppeteer.launch() throws Error: socket hang up in AWS Lambda, start by treating it as a Chromium startup failure. Puppeteer has reached the local Chrome DevTools WebSocket, but the browser process disconnected before the session was established. It is not, by itself, evidence that the website you wanted to visit rejected the request.
The most reliable fixes are to pair compatible chrome-aws-lambda and puppeteer-core versions, use the package’s launch settings, raise Lambda memory (at least 512 MB; 1,600 MB or more is recommended by the project), clean up /tmp, and inspect process and VPC failures separately.
First, identify where the disconnect occurs
“Socket hang up” describes a connection reset. In the commonly reported chrome-aws-lambda failure, the reset happens while launch() is opening a localhost Chrome DevTools connection. Chromium has started, crashed, been killed, or exited before Puppeteer can finish its handshake. Issue #207, opened April 1, 2021, documents this exact pattern: the same code worked locally but failed in Lambda during chromium.puppeteer.launch.
A different failure happens after launch. If launch() succeeds and the error appears during page.goto(), inspect DNS, TLS, HTTP responses, timeouts, and the destination site instead. Puppeteer issue #3927 describes browser disconnections during roughly 500 near-simultaneous invocations; that report is a concurrency and process-lifecycle clue, not proof that every socket error has one universal cause.
Recommended Free Tools
#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.
Use this diagnostic sequence
- Log the phase. Put separate log messages before and after
launch(), before navigation, and after navigation. This tells you whether the failure is the local browser handshake or an outbound page request. - Record versions and runtime details. Log the Node.js runtime, Lambda architecture,
chrome-aws-lambdaversion,puppeteer-core(orpuppeteer) version, and Chromium revision. Also record configured memory, timeout, and the remaining time when the exception occurs. - Read Chromium’s stderr and exit status. CloudWatch logs can reveal an out-of-memory kill, an immediate browser exit, a missing executable, or a sandbox/process error hidden behind the WebSocket reset.
- Only then investigate networking. A launch-time localhost reset points first to the browser process. A VPC route problem usually appears when the page makes an outbound request, although both problems can occur in the same invocation.
Align chrome-aws-lambda and Puppeteer versions
chrome-aws-lambda is not a generic Chromium binary. Its releases are tied to specific Puppeteer minor versions and Chromium revisions. Install the matching puppeteer-core version from the project’s compatibility table rather than selecting the newest versions independently. The project README says its package ships an appropriate binary for the latest stable Puppeteer release at the time of publication and requires the corresponding Puppeteer package.
For example, the legacy table pairs chrome-aws-lambda 10.1 with Puppeteer 10.1 and Chromium revision 884014 (Chrome 92.0.4512.0). That pairing is useful for a deliberately pinned historical stack, but it does not establish compatibility with a newer Lambda runtime, architecture, or Puppeteer release. Lock both dependencies in your package file and redeploy them together.
Check the architecture as well as the version
Lambda functions can run on different CPU architectures. A binary compiled for one architecture cannot be made reliable by changing a Puppeteer flag. Confirm that the Chromium package, Lambda architecture, Node.js runtime, and deployment artifact are intended to work together. If your runtime is newer than the legacy compatibility table, test a maintained Chromium package or a container image instead of forcing an old binary to run.
Start with the package’s known-good launch shape
Do not begin by adding a long list of copied Chromium flags. Use the values exported by the package, add only the settings your application needs, and close the browser on every path.
const chromium = require('chrome-aws-lambda');
exports.handler = async (event) => {
let browser;
try {
browser = await chromium.puppeteer.launch({
args: chromium.args,
defaultViewport: chromium.defaultViewport,
executablePath: await chromium.executablePath,
headless: chromium.headless,
ignoreHTTPSErrors: true
});
const page = await browser.newPage();
await page.goto(event.url || 'https://example.com', {
waitUntil: 'domcontentloaded'
});
return await page.title();
} finally {
if (browser) await browser.close();
}
};
The ignoreHTTPSErrors option should remain only when your application explicitly needs it. It does not fix a browser that dies during startup and can hide certificate problems that should be corrected at the destination or in your trust configuration.
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.
Add flags only for a diagnosed problem
The exported args already contain the package’s intended Lambda settings. Add a flag only after logs identify a concrete issue such as sandbox restrictions, shared-memory pressure, GPU initialization, or process limits. Randomly combining flags copied from unrelated Docker or Lambda examples can create a new incompatibility and make the original failure harder to reproduce.
Give Chromium enough memory and CPU
The chrome-aws-lambda README advises at least 512 MB of Lambda memory and recommends 1,600 MB or more. Memory is also tied to CPU allocation in Lambda, so a very small setting can make browser startup slow or unreliable even when the process is not strictly out of memory.
What to measure
- Configured memory and the maximum memory used for the invocation.
- Duration and remaining time when
launch()starts and when it fails. - Chromium stderr, exit codes, and any out-of-memory or signal messages.
- Whether the failure occurs only on cold starts, only under load, or at all concurrency levels.
If the browser is killed close to the timeout, increase the function timeout as well as memory. A timeout can surface as a disconnected DevTools socket because Puppeteer loses the process it was waiting for.
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 →Manage /tmp as disposable storage
Lambda may reuse an execution environment, so files in /tmp can survive between invocations in the same environment. Treat that directory as disposable and never assume a clean profile.
Use an isolated profile when you need one
Create a unique userDataDir beneath /tmp for a profile that must persist during one invocation. Do not let concurrent browser instances share the same profile directory. A shared profile can produce lock contention, corrupted state, or unexpected browser exits.
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.
Clean stale data deliberately
Close the browser in a finally block even when navigation fails. If reused environments accumulate profiles, crash dumps, or cache files, remove stale data before launch after confirming the logs show storage or profile accumulation. Do not delete another invocation’s active directory; use per-invocation names and retain only what your function needs.
The persistent /tmp/puppeteer_data directory shown in issue #3927 is a reason to inspect storage and concurrency behavior. It is not proof that every disconnect is caused by /tmp.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Separate VPC networking from browser startup
When a Lambda function is connected to a VPC, all outbound requests go through that VPC. Internet-bound navigation therefore needs a working route, commonly through a NAT gateway in a private subnet. Verify the complete path:
- Subnet route tables include the intended NAT route for outbound internet traffic.
- Security groups permit the required egress.
- Network ACLs allow return traffic. AWS notes that NACLs must allow ephemeral ports 1024–65535 for intermittent TCP/UDP failures.
- DNS resolution works from the selected subnets.
- The function role and account have the required permissions and ENI capacity.
A browser that cannot reach the target after it launches generally produces a navigation timeout, DNS error, or failed request. Fixing NAT will not repair a Chromium binary that exits before the DevTools connection is established; conversely, fixing the binary will not provide internet access to a VPC subnet with no NAT route.
Common symptoms, causes, and fixes
| Symptom | Most likely area | Action |
|---|---|---|
socket hang up immediately from launch() |
Chromium startup, incompatible package, memory, or process exit | Align versions, use exported launch fields, raise memory, and inspect stderr and exit status. |
| Launch works locally but fails in Lambda | Binary/runtime mismatch, architecture, permissions, or resource limits | Log runtime and architecture; deploy the package intended for that environment; test with more memory. |
| Launch succeeds, navigation times out in a VPC | Route, NAT, DNS, security group, or NACL | Check subnet routes, NAT, DNS, egress, and ephemeral-port rules. |
| Failures increase after repeated warm invocations | Stale /tmp profiles, disk pressure, or leaked browsers |
Use isolated directories, close in finally, and remove stale files when logs confirm accumulation. |
| Only high-concurrency bursts disconnect | Process, memory, storage, or concurrency pressure | Reduce reserved/concurrent load, raise memory, avoid shared profiles, and compare one browser per invocation with a controlled reuse strategy. |
| Certificate error is hidden by a workaround | Over-broad ignoreHTTPSErrors |
Use it only when required and fix the destination certificate or trust problem where possible. |
Make retries safe and useful
A retry can help with a transient process or capacity failure, but it cannot make incompatible binaries compatible. Retry only after logging the phase and error, and avoid immediately replaying a large burst at the same concurrency. Use a bounded retry count with backoff, create a fresh temporary profile for each attempt, and ensure the first browser process has been closed before starting another.
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
Do not retry blindly when the page itself is returning a deterministic HTTP error, when DNS is consistently broken, or when the function is near its timeout. Those cases need a configuration or destination fix.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →When to keep the legacy package and when to migrate
| Option | Best fit | Trade-offs to evaluate |
|---|---|---|
Pinned chrome-aws-lambda and matching Puppeteer |
A historical application already tied to the documented compatibility table | Simple launch API, but older Chromium revisions and a narrower runtime/architecture compatibility window. |
| Maintained Chromium package | Applications that need current Puppeteer releases on supported Lambda runtimes | Requires a new compatibility test and dependency pinning; package size and cold-start behavior still need measurement. |
| Lambda container image | Teams that need control over system libraries, browser version, and architecture | Larger deployment artifact and image-maintenance responsibility; cold starts and concurrency must be tested for your workload. |
Puppeteer’s current Lambda troubleshooting guidance points to sparticuz/chromium as a modern, vendor- and framework-agnostic option. Treat that as a migration candidate, not a drop-in guarantee: pin the browser and automation-library versions together and test your exact Node.js runtime, architecture, memory, and concurrency.
Or skip the browser setup
If your actual goal is a dependable image or PDF of a URL rather than running Chromium inside your own Lambda, ScreenshotNeo provides a website screenshot API and MCP server. It accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be disabled. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the result with X-Page-Verdict and X-Billed headers.
One GET request returns PNG, JPEG, WebP, or PDF. The API supports full-page captures with lazy images loaded, CSS-selector element captures, device presets and custom viewports, dark mode, retina scale, PDF paper and page-range controls, custom CSS and JavaScript, click-before-capture, hidden selectors, selector/delay/network-idle waits, request blocking, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, TTL caching, signed image links, asynchronous webhooks, bulk capture of up to 100 URLs per call, usage data, and an OpenAPI specification. Its parameter names are compatible with those used by other screenshot APIs, which can simplify migration.
cURL
The API details are in the ScreenshotNeo documentation.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Python
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
Node.js
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
ScreenshotNeo includes an MCP server with take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. Every feature is on every plan: 1,000 shots per month free with no card, then Starter $5 for 3,000, Growth $15 for 15,000, Pro $39 for 60,000, Scale $99 for 250,000, and Business $249 for 1,000,000; yearly billing provides two months free.
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.
Create a free ScreenshotNeo account to use the 1,000 monthly shots without a card.
Frequently Asked Questions
Does restarting the Lambda function fix a socket hang up permanently?
It can clear a damaged warm environment, but it does not correct a version mismatch, insufficient memory, architecture incompatibility, or missing VPC route. Use a restart only as a diagnostic clue, then fix the underlying condition.
Should I reuse one Puppeteer browser across Lambda invocations?
Reuse can reduce launch overhead, but it also increases the impact of leaked pages, stale profiles, and crashed processes. Start with one well-scoped browser per invocation; introduce reuse only after measuring memory, cleanup, and concurrency behavior.
Can a page’s anti-bot system cause this exact launch error?
A site’s bot check is reached during navigation, after Chromium has launched. A reset during launch() indicates the local browser process or its environment first; investigate destination blocking separately if navigation later fails.
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.

