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

Debug Puppeteer by first identifying which layer is failing: your Node.js code, code running in the page, or Chrome and its DevTools connection. Make the browser visible, capture browser and page logs, and then match the symptom to a specific cause—such as a missing Linux library, a sandbox restriction, an unavailable browser cache, or a selector that never becomes ready. Avoid changing launch flags or extending timeouts until you have evidence for the failure.

Start by locating the failure

A Puppeteer job crosses several boundaries, so the same symptom—such as a timeout—can have different causes. Reproduce it and determine where the failure occurs before changing configuration. The Puppeteer debugging guide recommends making the browser visible or slowing operations, then selecting diagnostics for the relevant layer. The guide is under /next/, so its details may change before a stable release.

  • Node.js layer: Your script, control flow, exception handling, or a call that is waiting indefinitely.
  • Page layer: The website’s JavaScript, DOM state, console errors, or an element that is absent or not ready.
  • Browser/protocol layer: Chrome launch, its operating environment, or communication between Puppeteer and Chrome.

Make the browser observable

For a minimal reproduction, launch a visible browser and optionally slow Puppeteer operations. Keep the same URL and relevant steps as the failing job so the behavior is comparable.

const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch({
    headless: false,
    slowMo: 100,
  });

  try {
    const page = await browser.newPage();
    page.on('console', message => {
      console.log(`[page:${message.type()}] ${message.text()}`);
    });
    page.on('pageerror', error => {
      console.error('[page error]', error);
    });

    await page.goto('https://example.com');
    await page.waitForSelector('h1');
    console.log('Page and selector loaded');
  } finally {
    await browser.close();
  }
})();

Visible mode and slowMo are investigation aids, not production settings. Once you can see what happens, remove them unless you specifically need them.

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.

Choose diagnostics by layer

  • Page code: Forward console events to Node logs. For interactive investigation, open DevTools and use debugger statements in page code.
  • Node.js code: Start Node with --inspect-brk to pause for a debugger, and inspect the browser through chrome://inspect/#devices.
  • Browser output: Set dumpio: true in launch options to forward the browser process’s stdout and stderr.
  • Protocol communication: Run with NODE_DEBUG="puppeteer:*" to log Puppeteer protocol traffic and inspect pending protocol errors. Protocol logs may contain sensitive data; review and redact them before sharing.

Fix browser installation and launch failures

“Could not find expected browser locally”

Since Puppeteer v19, downloaded browsers are stored under ~/.cache/puppeteer, using the home directory. If the process runs with an unexpected or unavailable home directory, Puppeteer may not find the browser where you expect. Check the installation environment, the effective home directory, and the configured cache path. If the default location is unsuitable, configure PUPPETEER_CACHE_DIR to a directory the running account can access. See the Puppeteer troubleshooting guide.

Chrome exits or reports missing shared libraries on Linux

First distinguish a missing dependency from a sandbox or profile problem. On Linux, Puppeteer’s troubleshooting guide suggests checking the Chrome executable’s shared-library dependencies:

ldd /path/to/chrome | grep not

Use the path to the Chrome executable actually being launched. Install missing dependencies using the package names for your distribution and release; Debian and CentOS package examples are not universal, and the required set can vary. Consult the guide’s current dependency references rather than copying a package list for a different image.

“No usable sandbox!” or a sandbox-related launch error

Investigate sandbox restrictions separately from missing libraries. On Ubuntu 23.10 and later, an AppArmor profile may prevent Chrome for Testing from using user namespaces. The troubleshooting guide links to Chromium’s AppArmor user-namespace restrictions documentation for workarounds. Confirm the distribution, version, Chrome build, and policy in effect before changing security settings.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.

Puppeteer’s troubleshooting documentation states: “Running without a sandbox is strongly discouraged.” Do not make --no-sandbox a routine fix. If you are considering it as a temporary diagnostic or environment-specific workaround, understand the security implications and prefer restoring a supported sandbox configuration.

Chrome cannot write its user-data directory

Puppeteer normally creates a temporary browser profile. If your environment needs an explicit profile path, set userDataDir and make sure the directory exists or can be created, is mounted writable, and is owned or accessible by the account running Chrome. A path writable on your workstation may be read-only in a container or server deployment.

const browser = await puppeteer.launch({
  userDataDir: '/path/to/writable/profile',
});

Docker child processes linger or become zombies

For Docker-specific failures, check the container’s privileges and process handling. Puppeteer’s troubleshooting guide notes that dumb-init may help when Chrome child processes remain as zombies. Treat this as an environment-specific investigation, not a universal requirement for every Puppeteer container.

Handle Alpine and Cloud Run as environment-specific cases

Alpine Linux

The Puppeteer troubleshooting guide says Chrome does not support Alpine out of the box, so compatible system dependencies must be installed and the exact image tested. It also flags timeout issues with the Chromium version in Alpine 3.20. That warning is specific to the documented distribution/version context; do not assume it applies to every Alpine release or current Chromium build. If a timeout occurs, record the Alpine release and Chromium version and reproduce with the same image.

Free tools Windows power users keep installed

One-click scans. No signup required.

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.

Google Cloud Run appears slow after responding

On Cloud Run, CPU is disabled by default after an HTTP response is written. A handler that sends its response and only then launches Puppeteer can therefore appear unusually slow. If the screenshot or browser work is part of the request, launch and complete it before sending the response. For genuine background work, the Puppeteer guide points to enabling always-allocated CPU. This behavior is specific to Cloud Run’s CPU allocation settings, not a general Puppeteer performance rule.

Fix selector and interaction timeouts

A selector timeout means Puppeteer did not observe the requested element or action preconditions within the allowed time. Before lengthening a timeout, check whether the selector is correct, whether navigation or application state has completed, and whether the intended element is inside a frame or otherwise not in the page context you queried.

Prefer Locators for interaction

Puppeteer’s page-interactions guide recommends Locators for selecting and interacting with elements. Locators wait for the element and relevant action preconditions, which makes them a better starting point for actions such as clicking than manually finding an element and immediately acting on it. A locator can have a per-locator timeout; Puppeteer throws a TimeoutError if the element is not found or its preconditions are not met in time.

const locator = page.locator('button[type="submit"]');
await locator.setTimeout(10_000);
await locator.click();

Choose a timeout based on the expected page behavior and your job’s overall deadline. A larger timeout cannot repair a wrong selector or a page that never reaches the expected state.

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.
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

Use waitForSelector when an explicit wait is appropriate

waitForSelector waits for a selector and throws if it does not appear before the timeout. It is a lower-level wait; it does not automatically retry a later action after that action fails. If it returns an ElementHandle, dispose of the handle when you are done to avoid retaining it unnecessarily.

const handle = await page.waitForSelector('h1', { timeout: 10_000 });
try {
  console.log(await handle.evaluate(element => element.textContent));
} finally {
  await handle.dispose();
}

Check the waitForSelector API reference for the API details applicable to your installed version.

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

Check Puppeteer and browser compatibility

Puppeteer is guaranteed to work with its bundled browser. Using a system browser or alternate channel is at your own risk, according to the LaunchOptions reference. If a failure began after upgrading Puppeteer or Chrome, capture the environment details before changing flags:

  • Puppeteer version.
  • Browser build and channel, including whether it is bundled or system-installed.
  • Operating system and version, including the container image if applicable.
  • Launch options and relevant environment variables.
  • The exact error and whether it occurs at launch, navigation, interaction, or shutdown.

Change one compatibility variable at a time and reproduce the same minimal case. This helps separate a version mismatch from a library, permissions, selector, or deployment issue.

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.

Troubleshooting checklist

Symptom First evidence to collect Likely next check
Expected browser not found Puppeteer version, effective home directory, cache path Check ~/.cache/puppeteer and configure PUPPETEER_CACHE_DIR if needed
Chrome exits during launch on Linux Browser stderr, executable path, OS and image version Check missing shared libraries with ldd, then investigate sandbox and writable profile separately
“No usable sandbox!” Linux distribution/version, Chrome build, sandbox error output Check sandbox support and, on relevant Ubuntu versions, AppArmor user-namespace restrictions
Selector wait or click times out Selector, page state, navigation sequence, frame context Use a Locator for interaction or verify whether an explicit selector wait is suitable
Slow after sending an HTTP response on Cloud Run When the response is written and when browser work starts Complete request work before responding, or configure always-allocated CPU for background work
Behavior changes after an upgrade Puppeteer/browser versions, launch options, OS Compare the browser build with the Puppeteer version and reproduce with the bundled browser

Or skip the browser setup

If the goal is to get a clean screenshot rather than diagnose your own browser automation stack, ScreenshotNeo is a website screenshot API and MCP server for developers. Its one-call endpoint accepts a URL and returns an image or PDF. See the ScreenshotNeo API documentation.

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

ScreenshotNeo accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each cleanup step can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits cost nothing, and response headers indicate the page verdict and whether the capture was billed. Its MCP server provides take_screenshot, get_page_info, and capture_pdf for AI agents and MCP clients. The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. Sign up for the free plan.

Frequently Asked Questions

How can I tell whether a Puppeteer timeout is caused by the page or Chrome?

Forward page console and page errors to Node logs, then compare them with browser process output and Puppeteer protocol errors. That separates page-side evidence from browser launch or communication failures.

Should I use --no-sandbox to fix Chrome launch errors?

No. Puppeteer strongly discourages running without a sandbox. Diagnose the actual sandbox restriction and use an environment-appropriate secure configuration instead.

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

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.