Open zzo opened 5 years ago
+1.
Sorry I don't know what Lighthouse produces. I've seen there have been multiple issues where people have had problem with Puppeteer where the trace logs aren't the same as If you use standalone Chrome, maybe it's something like that?
I provided a link to a gist containing what lighthouse produces - it looks a lot like the stuff in the test/ directory but not exactly apparently?
How specifically are you generating those test files via the chrome remote debugger protocol? From Network events like https://chromedevtools.github.io/devtools-protocol/tot/Network#event-responseReceived ?
thanks!!
I guess it still could be that the events are out of order and we don't catch that and in Chrome using Browsertime they are not. I will happily merge a PR if anyone can fix it :)
Best Peter
so do you think it's 'just' an ordering problem? do you look at the output from lighthouse in the gist? thanks!!
I don't know but that's my guess :)
ok ya I moved the 'Page.frameStartedLoading' event to the top the lighthouse-generated JSON file and all worked :) In the lighthouse file there are Network.requestWillBeSent and Network.responseReceived events in the file with the matching frameId BEFORE the Page.frameStartedLoading event with the same frameId. Not sure if the fix is to just error out with an explanation when this happens (easy) or to attempt to buffer those events and 'replay' them once we see the Page.frameStartedLoading event (hard), or to pre-process/re-write the json file on the fly when this condition is detected. OR just punt :)
I did a fix a couple of days ago to catch requestWillBeSent that happens before navigation https://github.com/sitespeedio/chrome-har/pull/34/files but then I guess also the responses are received in your trace before the frame started loading? Those responses could be mapped to the "unmapped" requests then.
Yes correct in my trace I see requests and a response BEFORE the Page.frameStartedLoading event with the matching frameId.
So when I use a lighthouse trace and run it thru the tests (with my 'fix' to move stuff to the beginning of the 'messages' array I get this error:
Generates valid HARs
/Users/m0t01b6/chrome-har/test/tests.js:32
31: const timings = entry.timings;
32: t.true(
33: entry._requestTime + Math.max(0, timings.blocked) / 1000 > previousEnd,
Two entries too close on connection 119
Value is not true
:
false
entry._requestTime + Math.max(0, timings.blocked) / 1000 > previousEnd => false
previousEnd => 47731.200914
entry._requestTime + Math.max(0, timings.blocked) / 1000 => 47731.119414
Math.max(0, timings.blocked) / 1000 => 0.0017649999999999999
Math.max(0, timings.blocked) => 1.765
timings.blocked => 1.765
timings => { _queued: 0.519, blocked: 1.765, connect: -1, dns: -1, receive: 0.62, send: 0.693, ssl: -1, wait: 78.558, }
Math => Object @Math {}
entry._requestTime => 47731.117649
dunno if you need the whole 'entry' object that gets dumped after this... So my 'fix' does not work? thanks!!
Having the same issue running chrome-har with puppeteer.
TypeError: Cannot read property 'content' of undefined
at harFromMessages (/Users/me/Desktop/har-backup/node_modules/chrome-har/index.js:316:28)
at /Users/me/Desktop/har-bckup/index.js:48:17
at <anonymous>
"chrome-har": "^0.7.0",
"puppeteer": "^1.11.0"
node: v8.14.0
Chromium: r609904
Thanks for any suggestions for getting this working.
Yeah, as I said before I think the problem is the order. I haven't had time to look at it yet, working on other things first.
I did a fix in 13a21ea5ac3162c3b42b4262bbfd0e5152b9ab64 for this, one thing missing is handling of redirects, I'll look at that later today.
I've pushed 0.7.1 with fixes that collect requests/responses that happens before navigation. One known bug is that it doesn't handle redirects. Please let me know if the new version works for you both!
Nice! thanks will give it a whirl
On Thu, Dec 13, 2018 at 12:17 PM Peter Hedenskog notifications@github.com wrote:
I've pushed 0.7.1 with fixes that collect requests/responses that happens before navigation. One known bug is that it doesn't handle redirects. Please let me know if the new version works for you both!
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sitespeedio/chrome-har/issues/35#issuecomment-447106403, or mute the thread https://github.com/notifications/unsubscribe-auth/AAr0GnYrTvq1LloJx2Q42VrX7O8cX3nmks5u4rXOgaJpZM4Y4dUk .
So https://github.com/GoogleChrome/lighthouse/issues/4005 implies this module will generate a HAR file from lighthouse output from the lighthouse cli like:
$ lighthouse --save-assets http://google.com
which generates several files the interesting one being: www.google.com_2018-11-28_11-31-08-0.devtoolslog.json
Trying the create a HAR file from that gives errors like:
Thoughts??? THANKS!!!