Skip to content

Commit a52a18a

Browse files
triuzziclaude
andcommitted
fix(browser): raise protocolTimeout to 10min for heavy pages
Heavy pages (e.g. dev bundles >100MB) cannot ack `Network.enable` and other auto-attached CDP domain calls within puppeteer's default 180s. Once the timeout fires, puppeteer marks the connection dead and every subsequent call throws `Network.enable timed out` — only daemon restart recovers. Set `protocolTimeout: 600000` on both `puppeteer.connect()` and `puppeteer.launch()`. Env-overridable via `CHROME_DEVTOOLS_PROTOCOL_TIMEOUT_MS` for power users. Hit in real workloads against a Brightcove Studio dev bundle (~160MB JS) where the default timeout fired before `list_pages` could complete, leaving the daemon permanently wedged. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent a0d6ea1 commit a52a18a

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/browser.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@ import {puppeteer} from './third_party/index.js';
2020

2121
let browser: Browser | undefined;
2222

23+
// Heavy pages (e.g. dev bundles >100MB) cannot ack `Network.enable` and
24+
// other auto-attached domain calls within puppeteer's default 180s.
25+
// Once that fires, the CDP connection is marked dead and every
26+
// subsequent call throws — only daemon restart recovers. Bumping the
27+
// ceiling to 10min covers realistic loads; override via env for power
28+
// users.
29+
const PROTOCOL_TIMEOUT_MS = parseInt(
30+
process.env.CHROME_DEVTOOLS_PROTOCOL_TIMEOUT_MS ?? '600000',
31+
10,
32+
);
33+
2334
function makeTargetFilter(enableExtensions = false) {
2435
const ignoredPrefixes = new Set(['chrome://', 'chrome-untrusted://']);
2536
if (!enableExtensions) {
@@ -61,6 +72,7 @@ export async function ensureBrowserConnected(options: {
6172
targetFilter: makeTargetFilter(enableExtensions),
6273
defaultViewport: null,
6374
handleDevToolsAsPage: true,
75+
protocolTimeout: PROTOCOL_TIMEOUT_MS,
6476
};
6577

6678
let autoConnect = false;
@@ -228,6 +240,7 @@ export async function launch(options: McpLaunchOptions): Promise<Browser> {
228240
ignoreDefaultArgs: ignoreDefaultArgs,
229241
acceptInsecureCerts: options.acceptInsecureCerts,
230242
handleDevToolsAsPage: true,
243+
protocolTimeout: PROTOCOL_TIMEOUT_MS,
231244
enableExtensions: options.enableExtensions,
232245
});
233246
if (options.logFile) {

0 commit comments

Comments
 (0)