-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Would be nice to know *what* timed out #112
Comments
Curiously, this fails every time: ▶ ./bin/minimalcss.js -d --verbose -o /tmp/songsearch.css https://songsear.ch/ It's strange because I can see that the server did respond with a 200 OK twice. As expected!
I grepped the access logs and could see my queries coming in and finishing just fine. |
I wrapped the - response = await page.goto(pageUrl, {
- waitUntil: ['domcontentloaded', 'networkidle0']
- })
+ try {
+ response = await page.goto(pageUrl, {
+ waitUntil: ['domcontentloaded', 'networkidle0']
+ })
+ } catch(ex) {
+ console.warn('IT FAILED', pageUrl);
+ console.error(ex.toString());
+ throw ex
+ }
+ But the error isn't particularly useful. It just says:
I wish that exception was more than just a string. |
I added a |
try |
I tried
...error. |
Trying with full debug on: env DEBUG="puppeteer:*" node --trace-warnings bin/minimalcss.js -d --verbose --skip google-analytics.com -o /tmp/songsearch.css https://songsear.ch/ > output.log 2>&1 |
Here's a reproducible case: 'use strict'
const puppeteer = require('puppeteer')
;(async () => {
const browser = await puppeteer.launch({})
const page = await browser.newPage()
await page.setRequestInterception(true)
page.on('request', request => request.continue())
try {
await page.goto('https://songsear.ch/', {
waitUntil: 'networkidle0', // fails
// waitUntil: 'networkidle2', // works
timeout: 2000
})
} catch (ex) {
console.warn('IT FAILED')
console.error(ex.toString())
throw ex
}
await browser.close()
})() If I replace |
Here's the output when it fails: |
'use strict';
const puppeteer = require('puppeteer');
class InflightRequests {
constructor(page) {
this._page = page;
this._requests = new Set();
this._onStarted = this._onStarted.bind(this);
this._onFinished = this._onFinished.bind(this);
this._page.on('request', this._onStarted);
this._page.on('requestfinished', this._onFinished);
this._page.on('requestfailed', this._onFinished);
}
_onStarted(request) {
this._requests.add(request);
}
_onFinished(request) {
this._requests.delete(request);
}
inflightRequests() {
return Array.from(this._requests);
}
dispose() {
this._page.removeListener('request', this._onStarted);
this._page.removeListener('requestfinished', this._onFinished);
this._page.removeListener('requestfailed', this._onFinished);
}
}
(async () => {
const browser = await puppeteer.launch({});
const page = await browser.newPage();
await page.setRequestInterception(true);
page.on('request', request => request.continue());
const tracker = new InflightRequests(page);
await page
.goto('https://songsear.ch/', {
waitUntil: 'networkidle0', // fails
// waitUntil: 'networkidle2', // works
timeout: 1000
})
.catch(e => {
console.log('Navigation failed: ' + e.message);
const inflight = tracker.inflightRequests();
console.log(inflight.map(request => ' ' + request.url()).join('\n'));
});
tracker.dispose();
await browser.close();
})(); Result:
Off-topic: there is an issue with serving assets from different domain. Picture from webpagetest.org |
First of all, does that mean the 1000ms timeout happened on Second, what do you mean about <link rel="preload" href="https://songsearch-2916.kxcdn.com/static/css/main.743e98de.css" as="style" onload="this.rel='stylesheet'"> |
On both. It is not that server didn't respond, it is just browser had not enough time to download it. If you would serve assets from the same domain with http2 you would save this 1 second (which is spent to connect to another domain). Just saying |
Yeah. With regards to songsear.ch I might just do that. I only just last month switched over to http2 on the main Nginx server. Now the extra connection cost outweighs the latency of the CDN proximity. Either way, I think |
I wonder if this is related: #213 |
Related #248 |
It seems I found error in puppeteer which cause it puppeteer/puppeteer#1454. Related stereobooster/react-snap#240 |
See
So most likely some asset or URL in that got stuck and took more than 30s. But I have no insight into which one it might be.
The text was updated successfully, but these errors were encountered: