Skip to content

Add protocolTimeout support to puppeteer launch options#307

Open
zenom wants to merge 1 commit into
Studiosity:mainfrom
zenom:add-protocol-timeout-support
Open

Add protocolTimeout support to puppeteer launch options#307
zenom wants to merge 1 commit into
Studiosity:mainfrom
zenom:add-protocol-timeout-support

Conversation

@zenom

@zenom zenom commented Jun 29, 2026

Copy link
Copy Markdown

Problem

Batch print jobs with large case counts can exceed Puppeteer's default 180 second CDP protocol timeout, resulting in:

ProtocolError: Network.enable timed out. Increase the 'protocolTimeout' setting in launch/connect calls for a higher timeout if needed.

This was reported in #248.

Root cause

Puppeteer exposes protocolTimeout in its launch options to raise this limit, but Grover never extracted it into launchParams — the value would silently pass through to page.pdf() where Puppeteer ignores it entirely.

Fix

Extract protocolTimeout from the options hash and pass it into launchParams before calling puppeteer.launch(), consistent with how launchTimeout, executablePath, and other launch options are handled.

Also adds protocol_timeout to the integer coercion list in OptionsFixer so it behaves consistently when set via HTML meta tags, which always produce string values.

Usage

Grover.new(html, protocol_timeout: 300_000).to_pdf

Or globally:

Grover.configure do |config|
  config.options = { protocol_timeout: 300_000 }
end

Batch print jobs with large case counts can exceed Puppeteer's default
180 second CDP protocol timeout, resulting in ProtocolError: Network.enable
timed out. Puppeteer exposes protocolTimeout in its launch options to raise
this limit, but Grover never extracted it into launchParams — the value
would silently pass through to page.pdf() where it has no effect. This
change extracts it so callers can configure the CDP timeout when
longer-running operations require it.

Also adds protocol_timeout to the integer coercion list in OptionsFixer
so it works consistently when set via HTML meta tags, which always
produce string values.

See: Studiosity#248
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant