chill117 / proxy-lists

Node.js module and CLI tool to get proxies from publicly available proxy lists.
MIT License
626 stars 106 forks source link

throw new Error('Data (' + ipType + ') has not been loaded.'); #39

Closed dabendan2 closed 7 years ago

dabendan2 commented 7 years ago

Hi Chill117, I've got below exception today. Maybe one of the sources returned ipv6 address? It seems ipv6 was disabled by default when invoking GeoIpNativeLite.loadDataSync and there is no any way to enable it.

2016-11-24T13:24:09.725112+00:00 app[web.1]: /app/node_modules/geoip-native-lite/index.js:24 2016-11-24T13:24:09.725115+00:00 app[web.1]: throw new Error('Data (' + ipType + ') has not been loaded.'); 2016-11-24T13:24:09.725116+00:00 app[web.1]: ^ 2016-11-24T13:24:09.725116+00:00 app[web.1]: 2016-11-24T13:24:09.725117+00:00 app[web.1]: Error: Data (ipv6) has not been loaded. 2016-11-24T13:24:09.725118+00:00 app[web.1]: at Object.module.exports.lookup (/app/node_modules/geoip-native-lite/index.js:24:10) 2016-11-24T13:24:09.725119+00:00 app[web.1]: at /app/nodemodules/proxy-lists/index.js:133:37 2016-11-24T13:24:09.725120+00:00 app[web.1]: at Function..map._.collect (/app/node_modules/underscore/underscore.js:172:24) 2016-11-24T13:24:09.725121+00:00 app[web.1]: at EventEmitter. (/app/node_modules/proxy-lists/index.js:131:16) 2016-11-24T13:24:09.725121+00:00 app[web.1]: at emitOne (events.js:90:13) 2016-11-24T13:24:09.725122+00:00 app[web.1]: at EventEmitter.emit (events.js:182:7) 2016-11-24T13:24:09.725123+00:00 app[web.1]: at /app/node_modules/proxy-lists/sources/proxydb.js:50:13 2016-11-24T13:24:09.725123+00:00 app[web.1]: at /app/node_modules/async/dist/async.js:2722:16 2016-11-24T13:24:09.725124+00:00 app[web.1]: at /app/node_modules/async/dist/async.js:484:16 2016-11-24T13:24:09.725125+00:00 app[web.1]: at /app/node_modules/async/dist/async.js:2664:9

chill117 commented 7 years ago

Looks like you are correct. What do you think would be the best way to make this configurable?

dabendan2 commented 7 years ago

I just cannot figure out how to catch this async exception. Anything can bypass this crash is fine for me. XD I'll suggest something like below if you ask me:

proxy-lists getProxies --iptypes="ipv4,ipv6"

var options = { iptypes: ["ipv4", "ipv6"] };

chill117 commented 7 years ago

I see. Then I think the best way to fix this would be to move the loading of the geo-ip data to inside the getProxies method(s) and load the data asynchronously. Then we could add an option as you suggest.

I won't have time to do this for at least a few days. If you can put together a fix and submit a PR, I will review and merge it as soon as I can.

92bondstreet commented 7 years ago

Maybe @antonecma, could you open a PR to solve the bug ;) ?

Thanks

antonecma commented 7 years ago

@92bondstreet, my fix is not implement @chill117 proposal. It is only exclude proxy which throws this error. But I will open PR on this weekend.

chill117 commented 7 years ago

@antonecma I don't think that would solve the root of the problem. This module should support ipv6. And as time goes on, more of the proxy lists will include ipv6 proxies.

hoducha commented 7 years ago

I've submitted a PR to fix the issue follow your ideas.

chill117 commented 7 years ago

Fixed by #41

Raslin777 commented 6 years ago

This error seems to have resurfaced?

C:\Users\wmarino\Desktop\ProxyList>proxy-lists -V
1.14.1

C:\Users\wmarino\Desktop\ProxyList>proxy-lists getProxies
Getting proxies...
Error: Missing required option (`option.bitproxies.apiKey`): You can get an API key for this service by creating an account at https://bitproxies.eu/
Error: Missing required option (`option.kingproxies.apiKey`): You can get an API key for this service by creating an account at https://kingproxies.com/register
Writing output to C:\Users\wmarino\Desktop\ProxyList/proxies.txt
C:\Users\wmarino\AppData\Roaming\npm\node_modules\proxy-lists\node_modules\geoip-native-lite\index.js:33
                        throw new Error('Data (' + ipType + ') has not been loaded.');
                        ^

Error: Data (ipv6) has not been loaded.
    at Object.lookup (C:\Users\wmarino\AppData\Roaming\npm\node_modules\proxy-lists\node_modules\geoip-native-lite\index.js:33:10)
    at C:\Users\wmarino\AppData\Roaming\npm\node_modules\proxy-lists\index.js:180:38
    at Function._.map._.collect (C:\Users\wmarino\AppData\Roaming\npm\node_modules\proxy-lists\node_modules\underscore\underscore.js:172:24)
    at EventEmitter.<anonymous> (C:\Users\wmarino\AppData\Roaming\npm\node_modules\proxy-lists\index.js:178:17)
    at emitOne (events.js:116:13)
    at EventEmitter.emit (events.js:211:7)
    at C:\Users\wmarino\AppData\Roaming\npm\node_modules\proxy-lists\sources\freeproxylist.js:36:14
    at C:\Users\wmarino\AppData\Roaming\npm\node_modules\proxy-lists\node_modules\async\dist\async.js:2556:16
    at C:\Users\wmarino\AppData\Roaming\npm\node_modules\proxy-lists\node_modules\async\dist\async.js:421:16
    at C:\Users\wmarino\AppData\Roaming\npm\node_modules\proxy-lists\node_modules\async\dist\async.js:2494:9
salesiss commented 5 years ago

Yes it really has resurfaced, mine is also proxy-lists version 1.14.1, still on ubuntu 16.04; node -v is v8.9.4

(output, same as Raslin777) Writing output to /home/test/proxies.txt /usr/local/lib/node_modules/proxy-lists/node_modules/geoip-native-lite/index.js:33 throw new Error('Data (' + ipType + ') has not been loaded.'); ^

Error: Data (ipv6) has not been loaded. at Object.lookup (/usr/local/lib/node_modules/proxy-lists/node_modules/geoip-native-lite/index.js:33:10) at /usr/local/lib/nodemodules/proxy-lists/index.js:180:38 at Function..map._.collect (/usr/local/lib/node_modules/proxy-lists/node_modules/underscore/underscore.js:172:24) at EventEmitter. (/usr/local/lib/node_modules/proxy-lists/index.js:178:17) at emitOne (events.js:116:13) at EventEmitter.emit (events.js:211:7) at /usr/local/lib/node_modules/proxy-lists/sources/freeproxylist.js:36:14 at /usr/local/lib/node_modules/proxy-lists/node_modules/async/dist/async.js:2556:16 at /usr/local/lib/node_modules/proxy-lists/node_modules/async/dist/async.js:421:16 at /usr/local/lib/node_modules/proxy-lists/node_modules/async/dist/async.js:2494:9 root@server1jax:/home/test# ls -ltr

1) But important: on our ubuntu 16.04; with node -v v12.10.0 there is no error

2) Sure there is also a problem with chrome and sandbox, we fixed it easly ourselves, but it was not related to "Error: Data (ipv6) has not been loaded". For the sandobox problem we followed "https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md", it was puppeteer related only.

chill117 commented 5 years ago

This was fixed in a prior release. Please upgrade to the latest version of proxy-lists.