"TypeError: file.requestHeaders is undefined" at har-builder.js:244:7 when attempting to "Save All As HAR" in nightly




Developer Tools: Netmonitor
7 months ago
2 days ago


(Reporter: asuth, Unassigned)



Firefox Tracking Flags

(firefox57 fix-optional)




7 months ago
I was just attempting to save a massive HAR trace from gmail in support of bug 1380896.  But I got the following error in the browser console each time I used the "Save All As HAR" option:

14:06:41.801 TypeError: file.requestHeaders is undefined 1 har-builder.js:244:7

I am using a recent nightly:
Version 	56.0a1
Build ID 	20170723100400
Multiprocess Windows 	3/3 (Enabled by user)
Web Content Processes 	

Note that there was no UI feedback in devtools in the form of a dialog or output in the devtools console.  It may be worth wrapping the export with better feedback like a progress bar or at least indicating failure, as the times when HAR export has worked for me in the past, it was really slow.  (Noting that I was trying to analyze a scenario where the spellchecker was going insane and dominating the main thread, so it probably wasn't the network monitor's fault ;)

Comment 1

7 months ago
I can confirm this as a long-time bug (at least as far back as 45.3).

In our use-case, we're making automated requests and exporting HARs. It appears as though the requestHeaders are filled asynchronously and the HAR export will eventually work, given enough time. Our workaround is to inspect the items to make sure each request contains requestHeaders and retry until validation passes (or the whole effort times out). Unfortunately, we limit the time to 1 minute and we've found many occasions that the validation will not pass in that limited time.
Priority: -- → P3

Comment 2

6 months ago
After update to Firefox 55.0.3 "Save All As HAR" didn't work for some sites with "TypeError: file.requestHeaders is undefined" "TypeError: file.requestHeaders is undefined"  error
status-firefox57: --- → fix-optional

Comment 3

4 months ago
"Save All As HAR" appears to not save in v56 on Mac and Windows. I frequently use this feature from "Developer Tool" > "Network"  and it stopped working in 55 or 56. I am using 56.0.2 (64-bit) on Mac 10.11.6

This looks related to bug 1376445 as "Copy All As HAR" also fails to copy. 

No indication is shown of the failure to save or copy the HAR file. 

I do not see this or any error in my console: TypeError: file.requestHeaders is undefined" "TypeError: file.requestHeaders is undefined"  error

Comment 4

3 months ago
"Save All As HAR" still does not work in 57. My observation - it stopped to work in 55.

For simple requests it works. Anything more complex (e.g. Gmail) and problem is there.
Can you please try Firefox Nightly? I think it's fixed.

Flags: needinfo?(bugmail)

Comment 6

2 days ago
What seems to happen now is that with a STR of:
- I switch to my existing gmail pinned tab with the calendar sidebar widget open.
- I open devtools and the network tab.
- I hit refresh so things show up in the network tab, in particular long-polls.
- I wait for the UI to stabilize, and I can clearly see several long-poll GETs

Here's what happens:
- The download dialog does not show up unless I wait a bit and then close the devtools, like it was waiting on a Promise (say, for the long-poll) to resolve, and that the window closure triggers rejections that makes things okay.  This seems consistent with the error that gets logged in the browser console:

TypeError: this.dataProvider is null [in har-exporter.js:179:7]
Stack trace:
requestData@resource://devtools/shared/base-loader.js -> resource://devtools/client/netmonitor/src/connector/firefox-connector.js:366:5
requestData@resource://devtools/shared/base-loader.js -> resource://devtools/client/netmonitor/src/connector/index.js:105:39
buildResponse@resource://devtools/shared/base-loader.js -> resource://devtools/client/netmonitor/src/har/har-builder.js:313:31

- If I close devtools pretty quickly after triggering the save-all, a "Task cancelled" line from (unknown) shows up in the browser console without a stack.
Flags: needinfo?(bugmail)
You need to log in before you can comment on or make changes to this bug.