dilame / instagram-private-api

NodeJS Instagram private API SDK. Written in TypeScript.
MIT License
5.93k stars 1.14k forks source link

SOCKS5 proxy not working on master #640

Closed benkaiser closed 5 years ago

benkaiser commented 5 years ago

I'm setting my proxy when creating the session like this:

return Client.Session.create(this._device, this._storage, this._username, this._password, PROXY_URL)

Where PROXY_URL looks like (with authentication params masked): socks5://user:password@proxy-nl.privateinternetaccess.com:1080

/app/node_modules/socks/build/common/helpers.js:27
        throw new util_1.SocksClientError(constants_1.ERRORS.InvalidSocksClientOptionsProxy, options);
        ^

Error: Invalid SOCKS proxy details were provided.
    at Object.validateSocksClientOptions (/app/node_modules/socks/build/common/helpers.js:27:15)
    at Function.createConnection (/app/node_modules/socks/build/client/socksclient.js:38:19)
    at GetAddrInfoReqWrap.onlookup [as callback] (/app/node_modules/socks-proxy-agent/index.js:118:17)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:62:10)

If I use curl with the same socks5 proxy it works just fine:

curl -x socks5://user:password@proxy-nl.privateinternetaccess.com:1080 www.google.com
benkaiser commented 5 years ago

Looks like once this is merged it will resolve: https://github.com/TooTallNate/node-socks-proxy-agent/pull/22

Until then I'm resorting to taking a dependency on the fork via adding:

    "socks-proxy-agent": "tynopet/node-socks-proxy-agent#bug/proxy-authentication",

to my dependencies and:

"socks-proxy-agent": "tynopet/node-socks-proxy-agent#bug/proxy-authentication"

to my "resolutions" in my package.json.

Also a separate issue is that you can't currently use domains with the socks library, see this issue: https://github.com/JoshGlazebrook/socks/issues/41