Open talShacharTufin opened 5 years ago
could not create a gist, due to size of json events file, but here is an attached code
it shows where it fails, and how it succeeds when all 9 relevant events are removed from events list
same issue I also hitting. both for SPA and simple website
@nathdebashish how do you generate the HAR, traces from Browsertime or puppeteer?
@talShacharTufin in some cases there are content for some web sites that are handled correctly by Chrome, and I think the way to "fix" that is to not be so strict as we are and just pass it. Let me have a look when I get the time!
@soulgalore just to be clear so i won't cause you any confusion. i'm not creating the har file i attached in a standard way inside the browser (by rightclicking the network tab and selecting "save har with content") i create it from code using puppeteer as i've shown here.
let events = [];
const client = await page.target().createCDPSession();
await client.send('Page.enable');
await client.send('Network.enable');
observe.forEach(method => {
client.on(method, params => {
events.push({ method, params });
});
});
so lets not ignore the possibility that the way i create the har file is the issue here (i don't really understand it, i just copied and pasted it from somewhere and for the most part it works ok)
Yep you can inject your own event in your events. Ask the Puppeteer team how to do that right.
@soulgalore just to be clear so i won't cause you any confusion. i'm not creating the har file i attached in a standard way inside the browser (by rightclicking the network tab and selecting "save har with content") i create it from code using puppeteer as i've shown here.
let events = []; const client = await page.target().createCDPSession(); await client.send('Page.enable'); await client.send('Network.enable'); observe.forEach(method => { client.on(method, params => { events.push({ method, params }); }); });
so lets not ignore the possibility that the way i create the har file is the issue here (i don't really understand it, i just copied and pasted it from somewhere and for the most part it works ok)
can pls provide this complete code snippet , so that I can try at my example. I have a single page application and need to capture har for page navigation
@nathdebashish how do you generate the HAR, traces from Browsertime or puppeteer?
@talShacharTufin in some cases there are content for some web sites that are handled correctly by Chrome, and I think the way to "fix" that is to not be so strict as we are and just pass it. Let me have a look when I get the time!
I tried dumping HAR using Puppeteer-har ( which internally uses chrome-har ) and a puppeteer supported js script My application is Single page application
@nathdebashish I was having the same issue, but looks like the error was recently fixed in this PR: https://github.com/sitespeedio/chrome-har/pull/53
i upgraded to "chrome-har": "^0.11.2"
and the error went away!
when trying to work on my application using puppeteer i attempted to use chrome-har to convert the session events into a har file everything works great, except a few requests (3 requests which are all served from browser cache) which seem to cause chrome-har to crash with following error message
this is how i created the browser session events that i used to create the har file that fails
this is an example of the problematic events (from a single requestId) that failed
when i remove all of the requests which are problematic (there are 3 requests, all related to this strange fontawesome-webfont url, with 3 events each, total 9 events) everything works great