Closed JohnPekl closed 5 years ago
I can't reproduce this. It works fine for me. What version are you using? Could you add a console.log(require('util').inspect(servers, { depth: null }));
before line 550?
Thanks for your module,
I am using version "speedtest-net": "^1.2.12", This issues infrequently occurs as it leaves my implemented code run for a whole day with the following (the error only occurred two times):
`setInterval(function pingTest() {
test = speedTest({
maxTime: 5000
});
return pingTest;
}(), 300000);`
I will add the log statement and will comment here if it occurs again.
I tried with the new version of your module "speedtest-net": "^1.3.1" and it occurred the same issues. Here is the log following your instruction.
{ html: { '$': { xmlns: 'http://www.w3.org/1999/xhtml', 'xml:lang': 'en', lang: 'en' }, head: [ { title: [ '404 - Not Found' ] } ], body: [ { h1: [ '404 - Not Found' ] } ] } } events.js:160 throw er; // Unhandled 'error' event ^
TypeError: Cannot read property 'servers' of undefined
at gotServers (/home/abc/Desktop/test/cdnnodejs/node_modules/speedtest-net/index.js:550:29)
at /home/abc/Desktop/test/speedNodejs/node_modules/speedtest-net/index.js:47:16
at /home/abc/Desktop/test/speedNodejs/node_modules/speedtest-net/index.js:240:7
at Parser.
Closing this for inactivity. Also, looks like SpeedTest couldn't find their page so I'm not sure how to fix that... I could make the error better but it would still not work.
events.js:160 throw er; // Unhandled 'error' event ^
TypeError: Cannot read property 'servers' of undefined at gotServers (/home/abc/Desktop/test/speedNodejs/node_modules/speedtest-net/index.js:550:29) at /home/abc/Desktop/test/speedNodejs/node_modules/speedtest-net/index.js:48:16 at /home/abc/Desktop/test/speedNodejs/node_modules/speedtest-net/index.js:241:7 at Parser. (/home/abc/Desktop/test/speedNodejs/node_modules/xml2js/lib/xml2js.js:489:18)
at emitOne (events.js:96:13)
at Parser.emit (events.js:188:7)
at Object.onclosetag (/home/abc/Desktop/test/speedNodejs/node_modules/xml2js/lib/xml2js.js:447:26)
at emit (/home/abc/Desktop/test/speedNodejs/node_modules/sax/lib/sax.js:640:35)
at emitNode (/home/abc/Desktop/test/speedNodejs/node_modules/sax/lib/sax.js:645:5)
at closeTag (/home/abc/Desktop/test/speedNodejs/node_modules/sax/lib/sax.js:905:7)
at Object.write (/home/abc/Desktop/test/speedNodejs/node_modules/sax/lib/sax.js:1452:13)
at Parser.exports.Parser.Parser.parseString (/home/abc/Desktop/test/speedNodejs/node_modules/xml2js/lib/xml2js.js:508:31)
at Parser.parseString (/home/abc/Desktop/test/speedNodejs/node_modules/xml2js/lib/xml2js.js:7:59)
at exports.parseString (/home/abc/Desktop/test/speedNodejs/node_modules/xml2js/lib/xml2js.js:540:19)
at /home/abc/Desktop/test/speedNodejs/node_modules/speedtest-net/index.js:239:5
at /home/abc/Desktop/test/speedNodejs/node_modules/speedtest-net/index.js:48:16