code-settings-sync: Extension is not working behind a proxy
Visual Studio Code Version : [ 1.4 ] Code Sync Settings Version : [ last on 2016-08-08 ] Operating System : [ Windows 7 ]
Error: getaddrinfo ENOTFOUND api.github.com api.github.com:443
at global.sendError (C:\Users\peninni2\.vscode\extensions\Shan.code-settings-sync-1.6.3\node_modules\github4\lib\index.js:753:19)
at C:\Users\peninni2\.vscode\extensions\Shan.code-settings-sync-1.6.3\node_modules\github4\lib\index.js:762:29
at callCallback (C:\Users\peninni2\.vscode\extensions\Shan.code-settings-sync-1.6.3\node_modules\github4\lib\index.js:639:17)
at ClientRequest.<anonymous> (C:\Users\peninni2\.vscode\extensions\Shan.code-settings-sync-1.6.3\node_modules\github4\lib\index.js:710:17)
at emitOne (events.js:90:13)
at ClientRequest.emit (events.js:182:7)
at TLSSocket.socketErrorListener (_http_client.js:295:9)
at emitOne (events.js:90:13)
at TLSSocket.emit (events.js:182:7)
at connectErrorNT (net.js:996:8)
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 5
- Comments: 26 (10 by maintainers)
I have published the 2.3.4 version with proxy support.
Hi @shanalikhan, to solve this problem, just add proxy into options when you create
node-githubinstance, like:new GitHubApi({ proxy: "http://127.0.0.1:1080" // ss proxy for example. })as the
node-githubis usinghttps-proxy-agentto handle proxy in itshttpSendfunction which is used to handle Gist/GitHub api.So, you can just save proxy settings into
syncSettings.jsonfile, and read it when your ext is activated.I’ve tested in my syncing ext and it worked well. Hope this would help!
You could e.g. use Fiddler (http://www.telerik.com/fiddler) to setup a test environment for proxy. This way could can even look which requests where sent to the proxy.
@shanalikhan 😄 It seems that this only solve the Gist proxy issue, but yes you can also use
https-proxy-agentwithhttpsmodule to solve the same problem in yourUtil.HttpPostJsonfunction 😃Here’s an example:
I found this solution here reference.