sitespeedio / sitespeed.io

sitespeed.io is an open-source tool for comprehensive web performance analysis, enabling you to test, monitor, and optimize your website’s speed using real browsers in various environments.
https://www.sitespeed.io/
MIT License
4.75k stars 602 forks source link

SiteSpeed with WPT private instance: Cannot call method 'toLowerCase' of undefined #713

Closed bbenichou closed 8 years ago

bbenichou commented 9 years ago

Hi @soulgalore,

In order to bypass the WPT public instance limitation I eventually configured my own WPT private instance. The instance itself works well and launch tests as expected when accessed from a browser.

However when I run a test via command line using sitespeed, the test launch normally but it seems the results can't be written.

My configuration: SiteSpeed+Graphite+Graphana: LINUX UBUNTU server 14.04 LTS WPT private instance: Windows Seven

Here is the command line I use: sudo docker run --privileged --rm -v /sitespeed.io:/sitespeed.io sitespeedio/sitespeed.io sitespeed.io -f myurls.txt -d 0 --noYslow --wptHost http://MY.WPT.IP.ADDRESS/ --wptConfig wptconfPrivate.json

My wptconfPrivate.json: { "pollResults": 10, "timeout": 1200, "firstViewOnly": false, "runs": 1, "private": true, "aftRenderingTime": true, "location": "Local-URLBlast", "Browser": "IE 8", "video": false, "connectivity": "LAN" }

The sitespeed-run.txt logs: error: Could not fetch data for aggregator: TTFBWPT: err: [TypeError: Cannot call method 'toLowerCase' of undefined] error: Could not fetch data for aggregator: BytesWPT: err: [TypeError: Cannot call method 'toLowerCase' of undefined] error: Could not fetch data for aggregator: FirstPaintWPT: err: [TypeError: Cannot call method 'toLowerCase' of undefined] error: Could not fetch data for aggregator: ImageSavingsWPT: err: [TypeError: Cannot call method 'toLowerCase' of undefined] error: Could not fetch data for aggregator: ImageTotalWPT: err: [TypeError: Cannot call method 'toLowerCase' of undefined] error: Could not fetch data for aggregator: LoadTimeWPT: err: [TypeError: Cannot call method 'toLowerCase' of undefined] error: Could not fetch data for aggregator: RenderWPT: err: [TypeError: Cannot call method 'toLowerCase' of undefined] error: Could not fetch data for aggregator: RequestsWPT: err: [TypeError: Cannot call method 'toLowerCase' of undefined] error: Could not fetch data for aggregator: ServerRTTWPT: err: [TypeError: Cannot call method 'toLowerCase' of undefined] error: Could not fetch data for aggregator: SpeedIndexWPT: err: [TypeError: Cannot call method 'toLowerCase' of undefined] error: Could not fetch data for aggregator: userTiming: err: [TypeError: Cannot call method 'toLowerCase' of undefined] error: Could not fetch data for aggregator: VisualCompleteWPT: err: [TypeError: Cannot call method 'toLowerCase' of undefined]

Any idea where these errors come from?

If needed I can provide more logs or details.

Thanks, Ben

soulgalore commented 9 years ago

Hi Ben, thanks for the bug report. Hmm, I'm away from my computer for a couple of days, but will try to help.

You could add the --verbose flag, then the full json from WebPageTest will be logged, then I think we can see why we have the errors. It will be a lot of info though. If you could add it to the issue that woukd be great!

Just want to verify: your own wpt-server works if you use the web gui?

Best Peter

bbenichou commented 9 years ago

Hi @soulgalore,

No problem, I've run a new test with one url only so the logs are slightly less longer. BTW yes my WPT works when I use the web gui.

Also please note that in my Wptconf.json:

If I write "location": "Local-URLBlast:IE 8", so "location:browser" I don't get any error in the sitespeed's logs but the test doesn't launch on my WPT instance. If I write the location + browser as in the json below, I get an error in the sitepseed log but the test launch and the result json is sent back.

Wptconf.json: { "pollResults": 10, "timeout": 1200, "firstViewOnly": false, "runs": 1, "private": true, "aftRenderingTime": true, "location": "Local-URLBlast", "browser": "IE 8", "video": false }

Command line: sudo docker run --privileged --rm -v /sitespeed.io:/sitespeed.io sitespeedio/sitespeed.io sitespeed.io -u http://www.bakerross.co.uk -d 0 --noYslow --wptHost http://XX.XX.XX.XX/ --wptConfig wptconfPrivate.json --verbose

Logs: Tue Jul 28 10:16:17 UTC 2015 ChromeDriver 2.14.313457 (3d645c400edf2e2c500566c9aa096063e707c9cf) Google Chrome 43.0.2357.81 Mozilla Firefox 38.0 Starting Xvfb ... Starting Selenium server ... access it at http://127.0.0.1:4444/wd/hub info: OS: 'linux 3.16.0-38-generic', Node.js: 'v0.10.25', sitespeed.io: '3.6.1', PhantomJS: '1.9.8', java: '1.7.0_79', browsertime: '0.9.7' info: Will crawl from start point http://www.bakerross.co.uk with crawl depth 0 info: Will analyze 1 pages error: Your location configuration Local-URLBlast needs to contain both the location and the browser! info: Running WebPageTest http://www.bakerross.co.uk pollResults=10, timeout=1200, firstViewOnly=false, runs=1, private=true, aftRenderingTime=true, location=Local-URLBlast, connectivity=Cable, video=false, browser=IE 8 verbose: Got the following from WebPageTest:{"response":{"statusCode":200,"statusText":"Ok","data":{"testId":"150728_SB_32a451a81174bca366244d0b12b817f8","summary":"http://10.66.16.114/result/150728_SB_32a451a81174bca366244d0b12b817f8/","testUrl":"http://www.bakerross.co.uk","location":"Local-URLBlast","connectivity":"Cable","bwDown":5000,"bwUp":1000,"latency":28,"plr":0,"completed":"Tue, 28 Jul 2015 09:13:24 +0000","runs":1,"successfulFVRuns":1,"successfulRVRuns":1,"average":{"firstView":{"loadTime":5591,"TTFB":449,"bytesIn":1338981,"bytesInDoc":1310964,"requests":137,"requestsDoc":105,"render":1191,"fullyLoaded":7901,"docTime":5591,"domTime":0,"titleTime":555,"avgRun":1},"repeatView":{"loadTime":5137,"TTFB":1504,"bytesIn":77714,"bytesInDoc":73673,"requests":21,"requestsDoc":13,"render":2136,"fullyLoaded":6255,"docTime":5137,"domTime":0,"titleTime":1667,"avgRun":1}},"median":{"firstView":{"run":1,"URL":"http://www.bakerross.co.uk","loadTime":5591,"TTFB":449,"bytesOut":84582,"bytesOutDoc":64535,"bytesIn":1338981,"bytesInDoc":1310964,"connections":51,"requests":137,"requestsDoc":105,"responses_200":121,"responses_404":0,"responses_other":1,"result":0,"render":1191,"fullyLoaded":7901,"cached":0,"docTime":5591,"domTime":0,"score_cache":90,"score_cdn":81,"score_gzip":97,"score_cookies":32,"score_keep-alive":99,"score_minify":100,"score_combine":55,"score_compress":69,"score_etags":33,"gzip_total":508855,"gzip_savings":15104,"minify_total":321488,"minify_savings":0,"image_total":844499,"image_savings":259198,"optimization_checked":1,"aft":0,"domElements":4502,"pageSpeedVersion":1.12,"title":"Craft Supplies | Children's Crafts | Art and Craft Shop","titleTime":555,"loadEventStart":0,"loadEventEnd":0,"domContentLoadedEventStart":0,"domContentLoadedEventEnd":0,"lastVisualChange":0,"browser_name":"Internet Explorer","browser_version":"8.0.7601.17514","server_count":1,"server_rtt":37,"adult_site":0,"date":1438078376,"PageSpeedData":"http://10.66.16.114/result/150728_SB_32a451a81174bca366244d0b12b817f8/1_pagespeed.txt"},"repeatView":{"run":1,"URL":"http://www.bakerross.co.uk","loadTime":5137,"TTFB":1504,"bytesOut":11668,"bytesOutDoc":7468,"bytesIn":77714,"bytesInDoc":73673,"connections":17,"requests":21,"requestsDoc":13,"responses_200":14,"responses_404":0,"responses_other":1,"result":0,"render":2136,"fullyLoaded":6255,"cached":1,"docTime":5137,"domTime":0,"score_cache":0,"score_cdn":0,"score_gzip":85,"score_cookies":78,"score_keep-alive":90,"score_minify":100,"score_combine":90,"score_compress":100,"score_etags":95,"gzip_total":72812,"gzip_savings":10286,"minify_total":17116,"minify_savings":0,"image_total":250,"image_savings":0,"optimization_checked":1,"aft":0,"domElements":4503,"pageSpeedVersion":1.12,"title":"Craft Supplies | Children's Crafts | Art and Craft Shop","titleTime":1667,"loadEventStart":0,"loadEventEnd":0,"domContentLoadedEventStart":0,"domContentLoadedEventEnd":0,"lastVisualChange":0,"browser_name":"Internet Explorer","browser_version":"8.0.7601.17514","server_count":1,"server_rtt":63,"adult_site":0,"date":1438078395,"PageSpeedData":"http://10.66.16.114/result/150728_SB_32a451a81174bca366244d0b12b817f8/1_Cached_pagespeed.txt"}},"run":{"id":1,"firstView":{"results":{"URL":"http://www.bakerross.co.uk","loadTime":5591,"TTFB":449,"bytesOut":84582,"bytesOutDoc":64535,"bytesIn":1338981,"bytesInDoc":1310964,"connections":51,"requests":137,"requestsDoc":105,"responses_200":121,"responses_404":0,"responses_other":1,"result":0,"render":1191,"fullyLoaded":7901,"cached":0,"docTime":5591,"domTime":0,"score_cache":90,"score_cdn":81,"score_gzip":97,"score_cookies":32,"score_keep-alive":99,"score_minify":100,"score_combine":55,"score_compress":69,"score_etags":33,"gzip_total":508855,"gzip_savings":15104,"minify_total":321488,"minify_savings":0,"image_total":844499,"image_savings":259198,"optimization_checked":1,"aft":0,"domElements":4502,"pageSpeedVersion":1.12,"title":"Craft Supplies | Children's Crafts | Art and Craft Shop","titleTime":555,"loadEventStart":0,"loadEventEnd":0,"domContentLoadedEventStart":0,"domContentLoadedEventEnd":0,"lastVisualChange":0,"browser_name":"Internet Explorer","browser_version":"8.0.7601.17514","server_count":1,"server_rtt":37,"adult_site":0,"date":1438078376},"pages":{"details":"http://10.66.16.114/result/150728_SB_32a451a81174bca366244d0b12b817f8/1/details/","checklist":"http://10.66.16.114/result/150728_SB_32a451a81174bca366244d0b12b817f8/1/performance_optimization/","breakdown":"http://10.66.16.114/result/150728_SB_32a451a81174bca366244d0b12b817f8/1/breakdown/","domains":"http://10.66.16.114/result/150728_SB_32a451a81174bca366244d0b12b817f8/1/domains/","screenShot":"http://10.66.16.114/result/150728_SB_32a451a81174bca366244d0b12b817f8/1/screen_shot/"},"thumbnails":{"waterfall":"http://10.66.16.114/result/150728_SB_32a451a81174bca366244d0b12b817f8/1_waterfall_thumb.png","checklist":"http://10.66.16.114/result/150728_SB_32a451a81174bca366244d0b12b817f8/1_optimization_thumb.png","screenShot":"http://10.66.16.114/result/150728_SB_32a451a81174bca366244d0b12b817f8/1_screen_thumb.jpg"},"images":{"waterfall":"http://10.66.16.114/results/15/07/28/SB/32a451a81174bca366244d0b12b817f8/1_waterfall.png","connectionView":"http://10.66.16.114/results/15/07/28/SB/32a451a81174bca366244d0b12b817f8/1_connection.png","checklist":"http://10.66.16.114/results/15/07/28/SB/32a451a81174bca366244d0b12b817f8/1_optimization.png","screenShot":"http://10.66.16.114/results/15/07/28/SB/32a451a81174bca366244d0b12b817f8/1_screen.jpg"},"rawData":{"headers":"http://10.66.16.114/results/15/07/28/SB/32a451a81174bca366244d0b12b817f8/1_report.txt","pageData":"http://10.66.16.114/results/15/07/28/SB/32a451a81174bca366244d0b12b817f8/1_IEWPG.txt","requestsData":"http://10.66.16.114/results/15/07/28/SB/32a451a81174bca366244d0b12b817f8/1_IEWTR.txt","utilization":"http://10.66.16.114/results/15/07/28/SB/32a451a81174bca366244d0b12b817f8/1_progress.csv","PageSpeedData":"http://10.66.16.114/result/150728_SB_32a451a81174bca366244d0b12b817f8/1_pagespeed.txt"}},"repeatView":{"results":{"URL":"http://www.bakerross.co.uk","loadTime":5137,"TTFB":1504,"bytesOut":11668,"bytesOutDoc":7468,"bytesIn":77714,"bytesInDoc":73673,"connections":17,"requests":21,"requestsDoc":13,"responses_200":14,"responses_404":0,"responses_other":1,"result":0,"render":2136,"fullyLoaded":6255,"cached":1,"docTime":5137,"domTime":0,"score_cache":0,"score_cdn":0,"score_gzip":85,"score_cookies":78,"score_keep-alive":90,"score_minify":100,"score_combine":90,"score_compress":100,"score_etags":95,"gzip_total":72812,"gzip_savings":10286,"minify_total":17116,"minify_savings":0,"image_total":250,"image_savings":0,"optimization_checked":1,"aft":0,"domElements":4503,"pageSpeedVersion":1.12,"title":"Craft Supplies | Children's Crafts | Art and Craft Shop","titleTime":1667,"loadEventStart":0,"loadEventEnd":0,"domContentLoadedEventStart":0,"domContentLoadedEventEnd":0,"lastVisualChange":0,"browser_name":"Internet Explorer","browser_version":"8.0.7601.17514","server_count":1,"server_rtt":63,"adult_site":0,"date":1438078395},"pages":{"details":"http://10.66.16.114/result/150728_SB_32a451a81174bca366244d0b12b817f8/1/details/cached/","checklist":"http://10.66.16.114/result/150728_SB_32a451a81174bca366244d0b12b817f8/1/performance_optimization/cached/","report":"http://10.66.16.114/result/150728_SB_32a451a81174bca366244d0b12b817f8/1/optimization_report/cached/","breakdown":"http://10.66.16.114/result/150728_SB_32a451a81174bca366244d0b12b817f8/1/breakdown/","domains":"http://10.66.16.114/result/150728_SB_32a451a81174bca366244d0b12b817f8/1/domains/","screenShot":"http://10.66.16.114/result/150728_SB_32a451a81174bca366244d0b12b817f8/1/screen_shot/cached/"},"thumbnails":{"waterfall":"http://10.66.16.114/result/150728_SB_32a451a81174bca366244d0b12b817f8/1_Cached_waterfall_thumb.png","checklist":"http://10.66.16.114/result/150728_SB_32a451a81174bca366244d0b12b817f8/1_Cached_optimization_thumb.png","screenShot":"http://10.66.16.114/result/150728_SB_32a451a81174bca366244d0b12b817f8/1_Cached_screen_thumb.jpg"},"images":{"waterfall":"http://10.66.16.114/results/15/07/28/SB/32a451a81174bca366244d0b12b817f8/1_Cached_waterfall.png","connectionView":"http://10.66.16.114/results/15/07/28/SB/32a451a81174bca366244d0b12b817f8/1_Cached_connection.png","checklist":"http://10.66.16.114/results/15/07/28/SB/32a451a81174bca366244d0b12b817f8/1_Cached_optimization.png","screenShot":"http://10.66.16.114/results/15/07/28/SB/32a451a81174bca366244d0b12b817f8/1_Cached_screen.jpg"},"rawData":{"headers":"http://10.66.16.114/results/15/07/28/SB/32a451a81174bca366244d0b12b817f8/1_Cached_report.txt","pageData":"http://10.66.16.114/results/15/07/28/SB/32a451a81174bca366244d0b12b817f8/1_Cached_IEWPG.txt","requestsData":"http://10.66.16.114/results/15/07/28/SB/32a451a81174bca366244d0b12b817f8/1_Cached_IEWTR.txt","utilization":"http://10.66.16.114/results/15/07/28/SB/32a451a81174bca366244d0b12b817f8/1_Cached_progress.csv","PageSpeedData":"http://10.66.16.114/result/150728_SB_32a451a81174bca366244d0b12b817f8/1_Cached_pagespeed.txt"}}}}}} error: Could not fetch data for aggregator: TTFBWPT: err: [TypeError: Cannot call method 'toLowerCase' of undefined] error: Could not fetch data for aggregator: BytesWPT: err: [TypeError: Cannot call method 'toLowerCase' of undefined] error: Could not fetch data for aggregator: FirstPaintWPT: err: [TypeError: Cannot call method 'toLowerCase' of undefined] error: Could not fetch data for aggregator: ImageSavingsWPT: err: [TypeError: Cannot call method 'toLowerCase' of undefined] error: Could not fetch data for aggregator: ImageTotalWPT: err: [TypeError: Cannot call method 'toLowerCase' of undefined] error: Could not fetch data for aggregator: LoadTimeWPT: err: [TypeError: Cannot call method 'toLowerCase' of undefined] error: Could not fetch data for aggregator: RenderWPT: err: [TypeError: Cannot call method 'toLowerCase' of undefined] error: Could not fetch data for aggregator: RequestsWPT: err: [TypeError: Cannot call method 'toLowerCase' of undefined] error: Could not fetch data for aggregator: ServerRTTWPT: err: [TypeError: Cannot call method 'toLowerCase' of undefined] error: Could not fetch data for aggregator: SpeedIndexWPT: err: [TypeError: Cannot call method 'toLowerCase' of undefined] error: Could not fetch data for aggregator: userTiming: err: [TypeError: Cannot call method 'toLowerCase' of undefined] error: Could not fetch data for aggregator: VisualCompleteWPT: err: [TypeError: Cannot call method 'toLowerCase' of undefined]

/usr/local/lib/node_modules/sitespeed.io/lib/collectors/pages.js:180 var browser = locationAndBrowser[1].toLowerCase(); ^ TypeError: Cannot call method 'toLowerCase' of undefined at /usr/local/lib/node_modules/sitespeed.io/lib/collectors/pages.js:180:41 at Array.forEach (native) at collectWPT (/usr/local/lib/node_modules/sitespeed.io/lib/collectors/pages.js:175:28) at Object.exports.processPage (/usr/local/lib/node_modules/sitespeed.io/lib/collectors/pages.js:35:5) at /usr/local/lib/node_modules/sitespeed.io/lib/collector.js:126:7 at Array.forEach (native) at Collector.collectPageData (/usr/local/lib/node_modules/sitespeed.io/lib/collector.js:125:19) at processAnalysisResults (/usr/local/lib/node_modules/sitespeed.io/lib/analyze/analyzer.js:171:14) at /usr/local/lib/node_modules/sitespeed.io/lib/analyze/analyzer.js:68:7 at /usr/local/lib/node_modules/sitespeed.io/node_modules/async/lib/async.js:254:17

Thanks for your help, Ben

norlover commented 9 years ago

I encountered the same problem

soulgalore commented 9 years ago

Hi @bbenichou , now I'm back, sorry for the delay. Ok, one thing that I missed is that WPT has different layouts of the JSON depending on how you setup your instance. Let me get back tomorrow and see if I have a fix.

Best Peter

bbenichou commented 9 years ago

Hi,

No problem.

Actually I think some of my WPT instance and WPT agents settings were not right. Also I was accessing the instance via RDP which was causing video issues affecting some WPT timings capture. And most of all I was using the URL-blast driver to capture timings through IE11.

Since I'm using WPT-driver to capture timings through the latest version of Chrome and Firefox it's -almost - all good.

I only get the - non blocking - error below:

error: Could not fetch data for aggregator: FirstPaintWPT err: [TypeError: Cannot call method 'toFixed' of undefined]

Hope it helps

Best, Ben

soulgalore commented 9 years ago

Hi Ben, for what IE version do you get FirstPaintWPT err?

I've tested and everything works for me except that the links to the HAR graphs is wrong if you configure a location without browser, will try to fix that.

/peter

bbenichou commented 9 years ago

Hi Peter,

I'm not using IE anymore since I've read IE11 and Url-Blast are not working well together.

I get the "FirstPaintWPT err" on Chrome 44 with the updated configuration below:

{ "pollResults": 10, "timeout": 2400, "firstViewOnly": true, "runs": 1, "private": true, "aftRenderingTime": true, "location": "Local-WPTDriver:Chrome", "video": true }

Ben

soulgalore commented 9 years ago

Aha, thanks, thats strange. Let me try to reproduce.

Best Peter

ibartj commented 8 years ago

Hey, I think I've just fixed the same error in my setup with these two lines:

lib/aggregators/wptAggregator.js line 61 var connectivity = browserAndLocation.response.data.connectivity ? browserAndLocation.response.data.connectivity.toLowerCase() : "lan";

lib/collectors/pages.js line 199 var connectivity = browserAndLocation.response.data.connectivity ? browserAndLocation.response.data.connectivity.toLowerCase() : "lan";

soulgalore commented 8 years ago

Closing old 3.x issues. Please reopen if you this still is an issue for 4.0.