Git Product home page Git Product logo

Comments (14)

abhagupta avatar abhagupta commented on September 7, 2024 1

+1.

from chrome-har.

soulgalore avatar soulgalore commented on September 7, 2024

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.

zzo avatar zzo commented on September 7, 2024

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.

soulgalore avatar soulgalore commented on September 7, 2024

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.

zzo avatar zzo commented on September 7, 2024

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.

soulgalore avatar soulgalore commented on September 7, 2024

I don't know but that's my guess :)

from chrome-har.

zzo avatar zzo commented on September 7, 2024

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.

soulgalore avatar soulgalore commented on September 7, 2024

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.

zzo avatar zzo commented on September 7, 2024

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.

smick avatar smick commented on September 7, 2024

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.

soulgalore avatar soulgalore commented on September 7, 2024

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.

soulgalore avatar soulgalore commented on September 7, 2024

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.

soulgalore avatar soulgalore commented on September 7, 2024

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.

zzo avatar zzo commented on September 7, 2024

from chrome-har.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.