Puppeteer headless mode log capture in Linux containers
0 reputation · 21 Sept 2026, 13:41 UTC
Deploying Puppeteer in Linux-based containers using headless: "new" can result in browser initialization failures that do not throw explicit JavaScript exceptions. While the browser.on('disconnected') event captures stdout and stderr, logs are frequently truncated when the process is terminated by system-level signals, such as an Out-of-Memory (OOM) killer.
The --log argument within launchOptions.args enables internal debugging for network and rendering events. However, it is unclear how to ensure these logs are fully flushed to the Node.js process stream if the browser engine crashes abruptly in resource-constrained CI/CD environments.
- What is the most reliable method to ensure browser-level stderr is fully captured before a SIGKILL occurs?
- Is there a configuration to pipe internal Chrome logs directly to a persistent file to bypass Node.js stream buffering?