Comments (14)
+1.
from chrome-har.
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?
from chrome-har.
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!!
from chrome-har.
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
from chrome-har.
so do you think it's 'just' an ordering problem? do you look at the output from lighthouse in the gist? thanks!!
from chrome-har.
I don't know but that's my guess :)
from chrome-har.
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 :)
from chrome-har.
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.
from chrome-har.
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!!
from chrome-har.
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.
from chrome-har.
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.
from chrome-har.
I did a fix in 13a21ea for this, one thing missing is handling of redirects, I'll look at that later today.
from chrome-har.
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!
from chrome-har.
from chrome-har.
Related Issues (20)
- bump tough-cookie dependency to 4.1.3 due to vulnerability HOT 1
- Invalid time value HOT 4
- Problems (i met) in Chrome Extension use HOT 1
- Support WebSocket in HAR HOT 3
- url.parse is deprecated HOT 1
- Early hints requests do not appear in HAR HOT 5
- Network.responseReceivedExtraInfo may be fired before or after responseReceived. HOT 3
- Response set-cookie header didn't align with chrome/firefox exported har HOT 2
- Redirects in main document are not detected as new page (explicit redirect or navigation) HOT 2
- Missing requests in iFrame within iFrame HOT 1
- Information missing from requests and responses HOT 1
- How to include the "_error" in the HAR file? HOT 4
- requestIntercepted deprecated. Support for responseReceived?
- Cached resources does not appear in har HOT 1
- TS types HOT 1
- discrepancies in Har generated from browsertime and Chorme DevTools HOT 1
- HAR file partially generated HOT 9
- possibility to get network without page fire events HOT 1
- How to determine if a request was preloaded ? HOT 6
- bump `debug` dependency version to latest version
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chrome-har.