Skip to content

Error generating url/summary/index #4124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ryanyango opened this issue Apr 3, 2024 · 35 comments
Open

Error generating url/summary/index #4124

ryanyango opened this issue Apr 3, 2024 · 35 comments

Comments

@ryanyango
Copy link

ryanyango commented Apr 3, 2024

Your question

Hi,
Im getting this error at the end of my run when i generate the report:

`ERROR: Could not generate url/summary/index, /usr/src/app/lib/plugins/html/templates/url/thirdparty/index.pug:24
22| h2 Third party
23|

24| - const thirdPartyWebVersion = pageInfo.data.coach.run ? pageInfo.data.coach.run.thirdPartyWebVersion : pageInfo.data.coach.pageSummary.thirdPartyWebVersion;
25| p Third party requests categorised by
26| a(href='https://github.com/patrickhulce/third-party-web') Third party web
27| |  version #{thirdPartyWebVersion}.

Cannot read properties of undefined (reading 'run')
[2024-03-28 00:36:43] ERROR: TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined
at writeFile (node:fs:2241:5)
at node:internal/util:442:7
at new Promise ()
at writeFile (node:internal/util:428:12)
at write (file:///usr/src/app/lib/core/resultsStorage/storageManager.js:26:10)
at file:///usr/src/app/lib/core/resultsStorage/storageManager.js:113:9
at async HTMLBuilder.render (file:///usr/src/app/lib/plugins/html/htmlBuilder.js:340:7)
Errors while running:
Rejected {
"uuid": "64dd553c-2196-4a86-9831-dc607c4c639f",
"type": "sitespeedio.render",
"timestamp": "2024-03-28T00:36:41+00:00",
"source": "queueHandler",
"data": "{...}"
} for plugin: html
{"code":"ERR_INVALID_ARG_TYPE"}
Error: Errors while running:
Rejected {
"uuid": "64dd553c-2196-4a86-9831-dc607c4c639f",
"type": "sitespeedio.render",
"timestamp": "2024-03-28T00:36:41+00:00",
"source": "queueHandler",
"data": "{...}"
} for plugin: html
{"code":"ERR_INVALID_ARG_TYPE"}
at start (file:///usr/src/app/bin/sitespeed.js:178:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async file:///usr/src/app/bin/sitespeed.js:189:1`

What does the error generally indicate and how would i got about troubleshooting this? This occurs in the sitespeedio/sitespeed.io:33.4.0 and sitespeedio/sitespeed.io:latest images.

@soulgalore
Copy link
Member

soulgalore commented Apr 3, 2024

Hi @ryanyango thank you for creating the issue! Can you share how you run and what URL you test so I can recreate it?

Thanks
Peter

@ryanyango
Copy link
Author

Hi @soulgalore i run the following command:

docker run --rm -v "$(pwd):/sitespeed.io" sitespeedio/sitespeed.io:latest -b chrome --multi <internal_url> ssio_workflow.mjs -n 1 --video
sharing the url wont help because its an internal test environment. What would be some steps i could take to start investigating the cause?

@soulgalore
Copy link
Member

It looks like no coach data is collected from one page. I would watch the browser and check if the script do what's its supposed to do: https://www.sitespeed.io/documentation/sitespeed.io/scripting/tutorial-07-Debugging-Scripts.html#watch-what's-going-on - maybe there's one step that do not work?

@yashgarde
Copy link

yashgarde commented Jul 9, 2024

I am also facing a similar issue:

Could not generate url/iteration/index, /Users/yash.garde/.nvm/versions/node/v20.9.0/lib/node_modules/sitespeed.io/lib/plugins/html/templates/url/cpu/index.pug:1
  > 1| - const browsertime = medianRun ? (pageInfo.data.browsertime ? pageInfo.data.browsertime.pageSummary.browserScripts[medianRun.runIndex - 1]: undefined) : pageInfo.data.browsertime.run 
    2| 
    3| - const cpu = medianRun ? (pageInfo.data.browsertime ? pageInfo.data.browsertime.pageSummary.cpu[medianRun.runIndex - 1]: undefined) : pageInfo.data.browsertime.run.cpu
    4| 

Cannot read properties of undefined (reading 'run')

This is also preceded by another interesting error message:
[2024-07-09 14:33:58] DEBUG: [sitespeedio.testrunner.773e78df-15f4-4ecd-b6e0-7403525768f5] [2024-07-09 14:33:58] ERROR: [browsertime] Could not add fullyLoaded metric to URL undefined, we have statistic for the URLs

For context, I am using Onlinetest all installed locally for the time being as well as a local (non-Dockerized) sitespeed.io to run my tests. The test case is run for 1 iteration and when I observe the browser, it is correctly reaching the final page of the test case via a script I have written.

Also unable to share URL's as it is an internal test environment that we are testing against.

Any suggestions for this?

@soulgalore
Copy link
Member

Hi @yashgarde cool, can you please share the script so I can reproduce it? It's really hard just to guess. Thank you!

@yashgarde
Copy link

Sorry for the delayed response, been trying to figure out the problem myself. I am unable to provide the exact script I am using that encounters the issue as it accesses internal webpages that we are targeting for performance testing. I will include the details of the nature of the tests and the details of what I have found so far below.

Here are some additional findings:

  1. The problem seems to occur only when using the --cpu=true configuration for sitespeed.io. With all other configs staying the same, adding the --cpu flag is what causes tests to fail with the following error:
[2024-07-18 13:58:33] ERROR: [sitespeedio.testrunner.4bec25b1-2a96-404a-9a70-b072f4eb00e9] Could not run sitespeed.io ExecaError: Command failed with exit code 1: sitespeed.io --config /Users/yash.garde/default/4bec25b1-2a96-404a-9a70-b072f4eb00e9/default-4bec25b1-2a96-404a-9a70-b072f4eb00e9-config.json --storeResult /Users/yash.garde/default/4bec25b1-2a96-404a-9a70-b072f4eb00e9/default-4bec25b1-2a96-404a-9a70-b072f4eb00e9-result.json --disableAPI true /Users/yash.garde/default/4bec25b1-2a96-404a-9a70-b072f4eb00e9/Test_Click_Through.mjs '--viewPort=1280x1024' -n 1 --multi --slug grafana_test_cpu

[2024-07-18 13:58:32] ERROR: Could not add fullyLoaded metric to URL undefined, we have statistic for the URLs ["https://perftoolswptdedicated.service-now.com/now/nav/ui/classic/params/target/incident.do%3Fsys_id%3D57af7aec73d423002728660c4cf6a71c%26sysparm_record_target%3Dincident%26sysparm_record_row%3D1%26sysparm_record_rows%3D67%26sysparm_record_list%3DORDERBYDESCnumber"] 
[2024-07-18 13:58:33] ERROR: Could not generate url/iteration/index, /Users/yash.garde/.nvm/versions/node/v20.9.0/lib/node_modules/sitespeed.io/lib/plugins/html/templates/url/cpu/index.pug:1
  > 1| - const browsertime = medianRun ? (pageInfo.data.browsertime ? pageInfo.data.browsertime.pageSummary.browserScripts[medianRun.runIndex - 1]: undefined) : pageInfo.data.browsertime.run 
    2| 
    3| - const cpu = medianRun ? (pageInfo.data.browsertime ? pageInfo.data.browsertime.pageSummary.cpu[medianRun.runIndex - 1]: undefined) : pageInfo.data.browsertime.run.cpu
    4| 

Cannot read properties of undefined (reading 'run')
node:internal/errors:497
    ErrorCaptureStackTrace(err);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined
    at writeFile (node:fs:2241:5)
    at node:internal/util:442:7
    at new Promise (<anonymous>)
    at writeFile (node:internal/util:428:12)
    at write (file:///Users/yash.garde/.nvm/versions/node/v20.9.0/lib/node_modules/sitespeed.io/lib/core/resultsStorage/storageManager.js:26:10)
    at file:///Users/yash.garde/.nvm/versions/node/v20.9.0/lib/node_modules/sitespeed.io/lib/core/resultsStorage/storageManager.js:113:9 {
  code: 'ERR_INVALID_ARG_TYPE'
}

Node.js v20.9.0
  1. Test scripts that involve simple navigations to pages and measuring performance are not impacted by this.
  2. The scripts that are failing involve the use commands.click.byJsAndWait where the argument to the function is used to navigate through the shadow dom of the webpage to reach and click the required elements.

Interestingly, not all click through based tests fail due to the --cpu flag. The scripts that are failing currently have a final measurement step of click on a hyperlink that is within an embedded iFrame (all this is of course layered within the shadow dom of the webpage as well).
4. I have tried to replicate this issue with publicly available webpages by simulating similar click through user journeys but have struggled to find a similarly layered shadow dom (which I don't believe is the issue here) with embedded iFrames.

Hopefully that gives you an idea of the nature of the testing, I am providing a sample version of the script I am using (with the URLs redacted) to give you an idea as well:

export default async function (context, commands) { 
    await commands.navigate('<redacted>');

    commands.meta.setTitle('Click first incident');
    await commands.click.byJsAndWait('<redacted>');
    await commands.click.byJsAndWait('<redacted>');
    
    await commands.measure.start('Click first INC');
    // Click on link within iFrame here
    await commands.click.byJsAndWait('<redacted>');
    return commands.measure.stop();
}

Additionally, when viewing the browser to see if the correct pages are loaded, all the right clicks and page loads are visible in the browser when running this setup locally.

@soulgalore
Copy link
Member

Ok, hmm. Do you use Chrome or Firefox?

[2024-07-18 13:58:32] ERROR: Could not add fullyLoaded metric to URL undefined, we have statistic for the URLs

That means that in the HAR file, the URL for the page does not match the URL of the browser window. In this case it does not have a URL in the HAR. The HAR is generated differently depending if its Chrome or Firefox, could you try if it works in the other browser? Maybe I could add some better logging so it's easier to see what's going on. Is the HAR file created, then you could drag/drop it into http://www.softwareishard.com/har/viewer/ and see what it looks like (is a page missing etc).

If you do not add --cpu don't you get the same error? Like the HTML is generated but you see the error?

@yashgarde
Copy link

I am only testing on Chrome at the moment, I will have a look tomorrow and see whether the HAR file is generated in the error case. I will try it out with Firefox as well and get back to you here.

To answer your second question, without the --cpu flag and the same erroneous test, I do see the same error message but with a successfully generated HTML result and also the fullyLoaded metric is calculated and rendered correctly.

@soulgalore
Copy link
Member

also the fullyLoaded metric is calculated and rendered correctly.

When I looked at the code, there's some logic to go through the HAR file and find the pages of each request and there something is broken because you get a URL that is undefined. Even though the HTML result is generated correctly, I think the HAR file is broken somehow. Can you share it or if you inspect it yourself? I would check for requests that do not match any page or a HAR that do not validate (drag/dropping the HAR into the HAR viewer will validate it).

@soulgalore
Copy link
Member

Also another way to see what's wrong would to be to collect the trace log for Chrome (that file is used for creating the HAR file). If you add --browsertime.chrome.collectPerfLog true to your test, that file is stored for each URL. In your data folder for each URL you will see a file named chromePerflog-1.json.gz. Those events are parsed using https://github.com/sitespeedio/chrome-har to generate the HAR. If you can provide that file too, then I think I could backtrack the error.

@yashgarde
Copy link

Back with an update:

  1. I ran the same test script (all locally this time since I am experiencing the same issue regardless of environment) both with and without the --cpu flag. In both cases, the HAR file was successfully generated and both were valid when I put them in the website/tool that you provided earlier

  2. I ran it with the --browsertime.chrome.collectPerfLog true as you requested as well an do see the generateed file each time. I am attaching a compressed file with the HAR file and the chromePerflog files for both the with and without --cpu flag runs.
    sitespeed-data.zip

@yashgarde
Copy link

Another update:
Just tried running the test with the --cpu flag on Firefox and the test completes but there is no CPU data populated in the CPU tab under Pages in the HTML view.

@soulgalore
Copy link
Member

That seems to be a bug for Firefox, I created #4233 for that.

@soulgalore
Copy link
Member

soulgalore commented Jul 20, 2024

Back with an update:

And the HAR files looks correct for you? By correct I mean all pages you test is included and requests looks ok? When I looked in the HARviewer the result looked identical for me but maybe I missed something? I will look a the perflog later.

@soulgalore
Copy link
Member

[2024-07-18 13:58:32] ERROR: Could not add fullyLoaded metric to URL undefined, we have statistic for the URLs

Ok, there's a bug in the code, where I simplified getting a URL for each page in the HAR that do not always work. I'll fix that but it will take a day or two. The second page in the HAR, that is a page that you navigate to (https://XXX/api/now/session/notification)?

@yashgarde
Copy link

Sorry for the delayed response, the HAR files look good to me. I do not actually navigate to the URL you mentioned (/api/session/notification) so I'm not entirely sure why that is in the HAR. I'll have a look at that on my end and confirm if that is expected behavior or not.

Cheers for finding the bug, let me know if there's a way I can help at all.

@yashgarde
Copy link

Update: the /api/session/notification in the HAR is expected behavior even though it is NOT a page we I explicitly navigate to in the script. It is a request that is part of the page load.

Additionally, I noticed that there is a difference between the HAR file I pulled from the sitespeed-results directory on the Onlinetest testrunner and the one I receive when I click Download HAR on the results HTML. Is this expected behavior?

@soulgalore
Copy link
Member

Ok, so that notification-URL is that in an iframe or can you see how that request is happening? I guess it can be a bug in chrome-har then, I haven't had time yet to check trace file yet, I hope to do that later this week.

@soulgalore
Copy link
Member

I had a quick look today but I wasn't able to fix it. I need to check the documentation for the Chrome events, we have many tests but some of them are using a really old version of the events and when I've done my changes, the tests broke. But I wonder if it's not the Chrome implementation that changed over time and that I should recreate all the test cases. I'll hope to be able to work on it this weekend.

@yashgarde
Copy link

Don't know if this is related to this issue at all, but one of my user journey tests (where I am only measuring the final page load) is currently throwing this error:

[2024-07-29 15:40:42] ERROR: RangeError: Invalid time value
    at Date.toISOString (<anonymous>)
    at m.toISOString (/home/ubuntu/.nvm/versions/node/v20.9.0/lib/node_modules/sitespeed.io/node_modules/chrome-har/node_modules/dayjs/dayjs.min.js:1:6270)
    at module.exports (/home/ubuntu/.nvm/versions/node/v20.9.0/lib/node_modules/sitespeed.io/node_modules/chrome-har/lib/entryFromResponse.js:189:53)
    at harFromMessages (/home/ubuntu/.nvm/versions/node/v20.9.0/lib/node_modules/sitespeed.io/node_modules/chrome-har/index.js:410:15)
    at getHar (file:///home/ubuntu/.nvm/versions/node/v20.9.0/lib/node_modules/sitespeed.io/node_modules/browsertime/lib/chrome/har.js:35:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Chromium.afterPageCompleteCheck (file:///home/ubuntu/.nvm/versions/node/v20.9.0/lib/node_modules/sitespeed.io/node_modules/browsertime/lib/chrome/webdriver/chromium.js:288:9)
    at async Measure.stop (file:///home/ubuntu/.nvm/versions/node/v20.9.0/lib/node_modules/sitespeed.io/node_modules/browsertime/lib/core/engine/command/measure.js:440:17)
    at async default (file:///home/ubuntu/default/4bcf1c7f-f8a7-43f5-91ce-8aa47103b163/Click_1st_INC.mjs:8:5)
    at async file:///home/ubuntu/.nvm/versions/node/v20.9.0/lib/node_modules/sitespeed.io/node_modules/browsertime/lib/core/engine/run.js:4:7
    at async Iteration.run (file:///home/ubuntu/.nvm/versions/node/v20.9.0/lib/node_modules/sitespeed.io/node_modules/browsertime/lib/core/engine/iteration.js:162:9)
    at async Engine.runByScript (file:///home/ubuntu/.nvm/versions/node/v20.9.0/lib/node_modules/sitespeed.io/node_modules/browsertime/lib/core/engine/index.js:308:20)
    at async analyzeUrl (file:///home/ubuntu/.nvm/versions/node/v20.9.0/lib/node_modules/sitespeed.io/lib/plugins/browsertime/analyzer.js:202:12)
    at async BrowsertimePlugin.processMessage (file:///home/ubuntu/.nvm/versions/node/v20.9.0/lib/node_modules/sitespeed.io/lib/plugins/browsertime/index.js:173:26)

This is followed by the following error:

[2024-07-29 15:40:42] ERROR: No data to collect
[2024-07-29 15:40:42] ERROR: Could not add fullyLoaded metric to URL undefined, we have statistic for the URLs ["https://perftoolswptdedicated.service-now.com/now/nav/ui/classic/params/target/incident.do%3Fsys_id%3D57af7aec73d423002728660c4cf6a71c%26sysparm_record_target%3Dincident%26sysparm_record_row%3D1%26sysparm_record_rows%3D67%26sysparm_record_list%3DORDERBYDESCnumber","https://perftoolswptdedicated.service-now.com/now/nav/ui/classic/params/target/incident.do%3Fsys_id%3D57af7aec73d423002728660c4cf6a71c%26sysparm_record_target%3Dincident%26sysparm_record_row%3D1%26sysparm_record_rows%3D67%26sysparm_record_list%3DORDERBYDESCnumber?browsertime_run=2"]

which is an error we have seen before.

These tests were not run with the --cpu flag and the test script passes for a single iteration but fails on any more than 1.

Let me know if you need more info or if this is even related?

@soulgalore
Copy link
Member

Hi @yashgarde can you please create another issue of that error. It looks like https://github.com/sitespeedio/chrome-har gets a timestamp from Chrome trace that is not correct. I can catch that but if you can share the trace I can make sure that its really work. Thanks!

@yashgarde
Copy link

Created a new issue #4243 as requested.

@ryanyango-alt
Copy link

Hi, is this issue still open?

I've had similiar findings below, my script also uses commands.click.byJsAndWait which seems to trigger the ERROR: Could not add fullyLoaded metric to URL undefined, error:

Sorry for the delayed response, been trying to figure out the problem myself. I am unable to provide the exact script I am using that encounters the issue as it accesses internal webpages that we are targeting for performance testing. I will include the details of the nature of the tests and the details of what I have found so far below.

Here are some additional findings:

  1. The problem seems to occur only when using the --cpu=true configuration for sitespeed.io. With all other configs staying the same, adding the --cpu flag is what causes tests to fail with the following error:
[2024-07-18 13:58:33] ERROR: [sitespeedio.testrunner.4bec25b1-2a96-404a-9a70-b072f4eb00e9] Could not run sitespeed.io ExecaError: Command failed with exit code 1: sitespeed.io --config /Users/yash.garde/default/4bec25b1-2a96-404a-9a70-b072f4eb00e9/default-4bec25b1-2a96-404a-9a70-b072f4eb00e9-config.json --storeResult /Users/yash.garde/default/4bec25b1-2a96-404a-9a70-b072f4eb00e9/default-4bec25b1-2a96-404a-9a70-b072f4eb00e9-result.json --disableAPI true /Users/yash.garde/default/4bec25b1-2a96-404a-9a70-b072f4eb00e9/Test_Click_Through.mjs '--viewPort=1280x1024' -n 1 --multi --slug grafana_test_cpu

[2024-07-18 13:58:32] ERROR: Could not add fullyLoaded metric to URL undefined, we have statistic for the URLs ["https://perftoolswptdedicated.service-now.com/now/nav/ui/classic/params/target/incident.do%3Fsys_id%3D57af7aec73d423002728660c4cf6a71c%26sysparm_record_target%3Dincident%26sysparm_record_row%3D1%26sysparm_record_rows%3D67%26sysparm_record_list%3DORDERBYDESCnumber"] 
[2024-07-18 13:58:33] ERROR: Could not generate url/iteration/index, /Users/yash.garde/.nvm/versions/node/v20.9.0/lib/node_modules/sitespeed.io/lib/plugins/html/templates/url/cpu/index.pug:1
  > 1| - const browsertime = medianRun ? (pageInfo.data.browsertime ? pageInfo.data.browsertime.pageSummary.browserScripts[medianRun.runIndex - 1]: undefined) : pageInfo.data.browsertime.run 
    2| 
    3| - const cpu = medianRun ? (pageInfo.data.browsertime ? pageInfo.data.browsertime.pageSummary.cpu[medianRun.runIndex - 1]: undefined) : pageInfo.data.browsertime.run.cpu
    4| 

Cannot read properties of undefined (reading 'run')
node:internal/errors:497
    ErrorCaptureStackTrace(err);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined
    at writeFile (node:fs:2241:5)
    at node:internal/util:442:7
    at new Promise (<anonymous>)
    at writeFile (node:internal/util:428:12)
    at write (file:///Users/yash.garde/.nvm/versions/node/v20.9.0/lib/node_modules/sitespeed.io/lib/core/resultsStorage/storageManager.js:26:10)
    at file:///Users/yash.garde/.nvm/versions/node/v20.9.0/lib/node_modules/sitespeed.io/lib/core/resultsStorage/storageManager.js:113:9 {
  code: 'ERR_INVALID_ARG_TYPE'
}

Node.js v20.9.0
  1. Test scripts that involve simple navigations to pages and measuring performance are not impacted by this.
  2. The scripts that are failing involve the use commands.click.byJsAndWait where the argument to the function is used to navigate through the shadow dom of the webpage to reach and click the required elements.

Interestingly, not all click through based tests fail due to the --cpu flag. The scripts that are failing currently have a final measurement step of click on a hyperlink that is within an embedded iFrame (all this is of course layered within the shadow dom of the webpage as well). 4. I have tried to replicate this issue with publicly available webpages by simulating similar click through user journeys but have struggled to find a similarly layered shadow dom (which I don't believe is the issue here) with embedded iFrames.

Hopefully that gives you an idea of the nature of the testing, I am providing a sample version of the script I am using (with the URLs redacted) to give you an idea as well:

export default async function (context, commands) { 
    await commands.navigate('<redacted>');

    commands.meta.setTitle('Click first incident');
    await commands.click.byJsAndWait('<redacted>');
    await commands.click.byJsAndWait('<redacted>');
    
    await commands.measure.start('Click first INC');
    // Click on link within iFrame here
    await commands.click.byJsAndWait('<redacted>');
    return commands.measure.stop();
}

Additionally, when viewing the browser to see if the correct pages are loaded, all the right clicks and page loads are visible in the browser when running this setup locally.

@soulgalore
Copy link
Member

@ryanyango-alt can you please share a example so I can test it and try to fix it? Thanks!

@ryanyango-alt
Copy link

@soulgalore

I cant give you all the details of the script, but the part that is erroring out is:

await commands.click.byJsAndWait('document.getElementById("cdv-tree").querySelectorAll("div[id*=ygtv] a:not([role=tab]):not(.summary-document)")[${i}]')

Note at this point of the script, its already at 3 nested iframes deep.

im running with the command:

docker run --rm -v "$(pwd):/sitespeed.io" sitespeedio/sitespeed.io:latest --multi my_url my_script.mjs -n 1 -b chrome

@bjkmd
Copy link

bjkmd commented Apr 1, 2025

Having the same issue here.

For some reason, while creating a HAR file from the list of messages in chrome-har, an additional page is added.
I wasn’t able to find the exact root cause.
It can only be reproduced on one specific page of the SPA.

Hotfix:
I resolved it by adding the following line to my Dockerfile:

RUN sed -i 's/if (pages.some((page) => page.__frameId === rootFrame)) {/if (pages.some((page) => page.__frameId === rootFrame) || frameId !== rootFrame) {/' /usr/src/app/node_modules/chrome-har/index.js

@CharlsChacko
Copy link

CharlsChacko commented Apr 9, 2025

Hello @soulgalore

Is there an update on this issue?

I am seeing the same issue where I am trying to run sitespeedio tests against a list of URLs against a dev environment which sits behind a login. I use the --preScript option which works fine where it logs in and then navigates to each of the URLs mentioned. But when the test runs the first URL of the list, can see below ERROR log

ERROR: [browsertime] There is an page without an URL in the HAR. Please inspect the HAR file and check whats wrong

And the test continues for other URLs which do not show this ERROR log in the tests.

But when all the tests against the URLs in the list finish and when the summary HTML is rendered is when the error happens and the test breaks, stopping the results from uploaded to the s3 bucket. Logs below:

[2025-04-09 02:26:34] DEBUG: [sitespeedio.plugin.html] Render HTML for 14 page(s)
[2025-04-09 02:26:34] DEBUG: [sitespeedio.plugin.html] Render URL page index
[2025-04-09 02:26:35] DEBUG: [sitespeedio.plugin.html] Render URL run page 1
[2025-04-09 02:26:35] DEBUG: [sitespeedio.plugin.html] Render URL metric page metrics
[2025-04-09 02:26:36] DEBUG: [sitespeedio.plugin.html] Render URL page index
[2025-04-09 02:26:36] DEBUG: [sitespeedio.plugin.html] Render URL run page 1
[2025-04-09 02:26:36] DEBUG: [sitespeedio.plugin.html] Render URL metric page metrics
[2025-04-09 02:26:36] DEBUG: [sitespeedio.plugin.html] Render URL page index
[2025-04-09 02:26:36] DEBUG: [sitespeedio.plugin.html] Render URL run page 1
[2025-04-09 02:26:36] DEBUG: [sitespeedio.plugin.html] Render URL metric page metrics
[2025-04-09 02:26:36] DEBUG: [sitespeedio.plugin.html] Render URL page index
[2025-04-09 02:26:36] DEBUG: [sitespeedio.plugin.html] Render URL run page 1
[2025-04-09 02:26:36] DEBUG: [sitespeedio.plugin.html] Render URL metric page metrics
[2025-04-09 02:26:36] DEBUG: [sitespeedio.plugin.html] Render URL page index
[2025-04-09 02:26:36] DEBUG: [sitespeedio.plugin.html] Render URL run page 1
[2025-04-09 02:26:36] DEBUG: [sitespeedio.plugin.html] Render URL metric page metrics
[2025-04-09 02:26:36] DEBUG: [sitespeedio.plugin.html] Render URL page index
[2025-04-09 02:26:36] DEBUG: [sitespeedio.plugin.html] Render URL run page 1
[2025-04-09 02:26:36] DEBUG: [sitespeedio.plugin.html] Render URL metric page metrics
[2025-04-09 02:26:36] DEBUG: [sitespeedio.plugin.html] Render URL page index
[2025-04-09 02:26:36] DEBUG: [sitespeedio.plugin.html] Render URL run page 1
[2025-04-09 02:26:36] DEBUG: [sitespeedio.plugin.html] Render URL metric page metrics
[2025-04-09 02:26:36] DEBUG: [sitespeedio.plugin.html] Render URL page index
[2025-04-09 02:26:36] DEBUG: [sitespeedio.plugin.html] Render URL run page 1
[2025-04-09 02:26:36] DEBUG: [sitespeedio.plugin.html] Render URL metric page metrics
[2025-04-09 02:26:36] DEBUG: [sitespeedio.plugin.html] Render URL page index
[2025-04-09 02:26:36] DEBUG: [sitespeedio.plugin.html] Render URL run page 1
[2025-04-09 02:26:36] DEBUG: [sitespeedio.plugin.html] Render URL metric page metrics
[2025-04-09 02:26:36] DEBUG: [sitespeedio.plugin.html] Render URL page index
[2025-04-09 02:26:36] DEBUG: [sitespeedio.plugin.html] Render URL run page 1
[2025-04-09 02:26:36] DEBUG: [sitespeedio.plugin.html] Render URL metric page metrics
[2025-04-09 02:26:36] DEBUG: [sitespeedio.plugin.html] Render URL page index
[2025-04-09 02:26:36] DEBUG: [sitespeedio.plugin.html] Render URL run page 1
[2025-04-09 02:26:36] DEBUG: [sitespeedio.plugin.html] Render URL metric page metrics
[2025-04-09 02:26:36] DEBUG: [sitespeedio.plugin.html] Render URL run page 2
[2025-04-09 02:26:36] ERROR: [sitespeedio.plugin.html] Could not generate url/iteration/index, /usr/src/app/lib/plugins/html/templates/url/cpu/index.pug:1
1| - const browsertime = medianRun ? (pageInfo.data.browsertime ? pageInfo.data.browsertime.pageSummary.browserScripts[medianRun.runIndex - 1]: undefined) : pageInfo.data.browsertime.run
2|
3| - const cpu = medianRun ? (pageInfo.data.browsertime ? pageInfo.data.browsertime.pageSummary.cpu[medianRun.runIndex - 1]: undefined) : pageInfo.data.browsertime.run.cpu
4|
Cannot read properties of undefined (reading 'run')
[2025-04-09 02:26:36] DEBUG: [sitespeedio.plugin.html] Render URL run page 3
[2025-04-09 02:26:36] DEBUG: [sitespeedio.plugin.html] Render URL page index
[2025-04-09 02:26:36] ERROR: [sitespeedio.plugin.html] Could not generate url/iteration/index, /usr/src/app/lib/plugins/html/templates/url/cpu/index.pug:1
1| - const browsertime = medianRun ? (pageInfo.data.browsertime ? pageInfo.data.browsertime.pageSummary.browserScripts[medianRun.runIndex - 1]: undefined) : pageInfo.data.browsertime.run
2|
3| - const cpu = medianRun ? (pageInfo.data.browsertime ? pageInfo.data.browsertime.pageSummary.cpu[medianRun.runIndex - 1]: undefined) : pageInfo.data.browsertime.run.cpu
4|
Cannot read properties of undefined (reading 'run')
node:fs:2311
validateStringAfterArrayBufferView(data, 'data');
^
TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined
at writeFile (node:fs:2311:5)
at node:internal/util:432:7
at new Promise ()
at writeFile (node:internal/util:418:12)
at write (file:///usr/src/app/lib/core/resultsStorage/storageManager.js:26:10)
at file:///usr/src/app/lib/core/resultsStorage/storageManager.js:113:9 {
code: 'ERR_INVALID_ARG_TYPE'
}
Node.js v20.17.0

Thank you for your help.

@soulgalore
Copy link
Member

Hi @CharlsChacko , I can have a look at your issue later today. The thing with the "issue" is that even though the logs says the same in some cases, it is still different issues depending on what kind of script and test you run. I'm still looking for someone that could actually share a reproducible case. But I'll have a look at your case and see if I can understand what's going on.

@soulgalore
Copy link
Member

Hi @CharlsChacko I didn't see which browser you are using (the HAR is handled differently in Chrome vs Firefox).

ERROR: [browsertime] There is an page without an URL in the HAR. Please inspect the HAR file and check what's wrong

Do you get a HAR file for the page that failed that you can share?

soulgalore added a commit that referenced this issue Apr 10, 2025
@soulgalore
Copy link
Member

Hi @CharlsChacko as a first step I released 37.4.1 with a fix that at least fixes the problem of that the test totally fail in the end. For the root cause, need your input about browser and if you have the HAR file.

@CharlsChacko
Copy link

CharlsChacko commented Apr 11, 2025

Thank you @soulgalore. Will upgrade to this and see how this resolves the test failures.

Regarding the details you had asked:

Please let me know any other information is needed from my side. Thank you for your help.

@soulgalore
Copy link
Member

Hi @CharlsChacko thank you I will see what I can do this weekend.

When I checked the HAR I could see that all requests is attached to page number two (you can see that when you drag/drop it into http://www.softwareishard.com/har/viewer/), that is wrong/broken, they should all be attached to the first page. Is it easy for you to run the test/reproduce it? Then if you could add --browsertime.chrome.collectPerfLog true you will get the internal log from Chrome that is used for generating the HAR file. If you can share that file with me that would be great and would help a lot. You can email it to me: peter [AT] soulgalore.com.

Thank you!

@CharlsChacko
Copy link

Hello @soulgalore

I was able to reproduce the issue with the collectperfLog option enabled and have emailed the details you have asked.
Please let me know if any further details are needed. Thank you.

@soulgalore
Copy link
Member

soulgalore commented Apr 14, 2025

I had a go on Sunday but didn't get it to work 100%. There's those iframes that breaks generation and we need some smarter way to handle that. Will have another go soon.

soulgalore added a commit to sitespeedio/chrome-har that referenced this issue Apr 22, 2025
@CharlsChacko
Copy link

Hello @soulgalore
We have upgraded to v37.4.1 and since then the tests have not totally failed and has been very helpful. Thank you.
Please let us know when you have a complete fix for the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants