devtools icon indicating copy to clipboard operation
devtools copied to clipboard

HAR file downloaded from DevTools can not be loaded in Chrome DevTools

Open elliette opened this issue 10 months ago • 4 comments

Steps to reproduce:

  1. Connect to an app that makes network requests
  2. Navigate to network screen
  3. Choose option to download as HAR file
  4. Open Chrome DevTools
  5. Navigate to Chrome DevTools network tab
  6. Import the dowloaded HAR file

Import fails with the following error:

Failed to load HAR file with following error: Casting to number results in NaN

Potentially we are creating an invalid HAR file?

elliette avatar Feb 20 '25 20:02 elliette

@elliette is this on the master branch? or else can you share which version of devtools you are using? Also if this is happening with some specific requests, is it possible for you to share that data here?

hrajwade96 avatar Mar 16 '25 18:03 hrajwade96

Hmm, on a simple set of a few POST requests, I was able to successfully import into Chrome DevTools. I think the data found in the network requests is probably important to reproducing.

srawlins avatar Mar 20 '25 23:03 srawlins

@elliette would it be possible to share the .har itself if it doesn't have any private data ?

hrajwade96 avatar Apr 10 '25 07:04 hrajwade96

I was able to reproduce this issue in some requests, after debugging I found the issue occurs for har files which have requests with status "error", and the value defaults to "error", it needs to be defaulted to -1 for chrome devtools to be able to read it. I have added a fix in one of the PR I have raised, at present I am adding few other fixes and improvements in it.

Additionally, I’m checking to ensure no other similar cases are missed.

hrajwade96 avatar May 25 '25 18:05 hrajwade96