question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

page.goto() with a certain URL throws TimeoutException when request interception is enabled, even if no request is aborted

See original GitHub issue

I’ve been using this code for a while and it worked flawlessly, until today I found an URL which always fails to load with TimeoutException. Here’s the test function code:

const puppeteer = require("puppeteer");

(async () => {
	const browser = await puppeteer.launch();
	const page = await browser.newPage();
	await page.setDefaultNavigationTimeout(120000);
	await page.setRequestInterception(true);
	page.on("request", request => {
		request.continue();
	});

	try {
		const response = await page.goto("http://curious.astro.cornell.edu/the-universe/cosmology-and-the-big-bang/104-the-universe/cosmology-and-the-big-bang/expansion-of-the-universe/616-is-the-universe-expanding-faster-than-the-speed-of-light-intermediate");
		console.log("Response code: " + response.status() + (response.ok() ? " (OK)" : " (ERROR)"));
	} catch(exc) {
		console.log("Response: empty.");
	}

	await browser.close();
})();

When I Initially discovered this bug(?), I was using request interception to filter out images, but then I found out one does not have to abort any requests at all in order for the problem to appear. This page.goto() will always time out, as you can see, I even upped the timeout to 2 minutes and it made no difference. But as soon as you comment out the request interception part, it loads no problem in 7-8 seconds and reports status “200 (OK)”.

Environment: Windows 10 x64 Puppeteer v 1.9.0, Chromium: bundled Node v8.11.4

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jlcdcommented, Oct 19, 2018

Same issue… If I await page.setRequestInterception(false); right before some calls, it works fine, but if I leave request interception on, it doesn’t load at all. I’ve seen a few open issues (#3118 ; #2055 …) regardind this exact problem and on #1159 someone said it would be fixed on 1.8.0, but I’m using 1.9.0 and this issue still persists.

'--enable-features=NetworkService' doesn’t help at all.

0reactions
aslushnikovcommented, Nov 1, 2018

Merging this to #3471 that’s dedicated to fixing request interception once and for all. Please upvote to follow updates.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Request Interception - Puppeteer
Once request interception is enabled, every request will stall unless it's continued, responded or aborted. An example of a naïve request interceptor that ......
Read more >
node.js - Puppeteer: how to wait only first response (HTML)
The DOMContentLoaded event fires when the initial HTML document has been completely loaded and parsed, without waiting for stylesheets, images, ...
Read more >
Page | playwright-ruby-client
page.goto('https://example.com/') # => prints 'a request was made: ... have not finished during the specified timeout , this method throws a TimeoutError ....
Read more >
node_modules/puppeteer/lib/types.d.ts - devtools ... - Google Git
interception should be enabled with {@link Page.setRequestInterception}. *. * Exception is immediately thrown if the request interception is not enabled.
Read more >
class: Page | API |《Puppeteer 中文文档 3.1.0》 - LearnKu
In order to intercept and mutate requests, see page. ... If no URLs are specified, this method returns cookies for the current page...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found