Skip to content

Commit

Permalink
fix: increase the default protocol timeout (#9928)
Browse files Browse the repository at this point in the history
  • Loading branch information
OrKoN committed Mar 28, 2023
1 parent c4e1675 commit 4465f4b
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/api/puppeteer.browserconnectoptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ export interface BrowserConnectOptions
| ---------------------------------------------------------------------------- | --------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ | ------- |
| [defaultViewport?](./puppeteer.browserconnectoptions.defaultviewport.md) | | [Viewport](./puppeteer.viewport.md) \| null | _(Optional)_ Sets the viewport for each page. | |
| [ignoreHTTPSErrors?](./puppeteer.browserconnectoptions.ignorehttpserrors.md) | | boolean | _(Optional)_ Whether to ignore HTTPS errors during navigation. | false |
| [protocolTimeout?](./puppeteer.browserconnectoptions.protocoltimeout.md) | | number | _(Optional)_ Timeout setting for individual protocol (CDP) calls. | 30000 |
| [protocolTimeout?](./puppeteer.browserconnectoptions.protocoltimeout.md) | | number | _(Optional)_ Timeout setting for individual protocol (CDP) calls. | 180000 |
| [slowMo?](./puppeteer.browserconnectoptions.slowmo.md) | | number | _(Optional)_ Slows down Puppeteer operations by the specified amount of milliseconds to aid debugging. | |
| [targetFilter?](./puppeteer.browserconnectoptions.targetfilter.md) | | [TargetFilterCallback](./puppeteer.targetfiltercallback.md) | _(Optional)_ Callback to decide if Puppeteer should connect to a given target or not. | |
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ interface BrowserConnectOptions {

#### Default value:

30000
180000
2 changes: 1 addition & 1 deletion packages/puppeteer-core/src/common/BrowserConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export interface BrowserConnectOptions {
/**
* Timeout setting for individual protocol (CDP) calls.
*
* @defaultValue 30000
* @defaultValue 180000
*/
protocolTimeout?: number;
}
Expand Down
9 changes: 7 additions & 2 deletions packages/puppeteer-core/src/common/Connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,12 @@ class Callback {
this.#label = label;
if (timeout) {
this.#timer = setTimeout(() => {
this.#promise.reject(rewriteError(this.#error, `${label} timed out.`));
this.#promise.reject(
rewriteError(
this.#error,
`${label} timed out. Increase the 'protocolTimeout' setting in launch/connect calls for a higher timeout if needed.`
)
);
}, timeout);
}
}
Expand Down Expand Up @@ -194,7 +199,7 @@ export class Connection extends EventEmitter {
super();
this.#url = url;
this.#delay = delay;
this.#timeout = timeout ?? 30000;
this.#timeout = timeout ?? 180_000;

this.#transport = transport;
this.#transport.onmessage = this.onMessage.bind(this);
Expand Down
2 changes: 1 addition & 1 deletion packages/puppeteer-core/src/common/bidi/Connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class Connection extends EventEmitter {
constructor(transport: ConnectionTransport, delay = 0, timeout?: number) {
super();
this.#delay = delay;
this.#timeout = timeout;
this.#timeout = timeout ?? 180_000;

this.#transport = transport;
this.#transport.onmessage = this.onMessage.bind(this);
Expand Down

0 comments on commit 4465f4b

Please sign in to comment.