Code-settings-sync: Extension is not working behind a proxy

Created on 8 Aug 2016  路  26Comments  路  Source: shanalikhan/code-settings-sync

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)
feature-request 馃挕 fixed

Most helpful comment

I have published the 2.3.4 version with proxy support.

All 26 comments

yes there is some problem working in proxy i am already acknowledged of. You can debug and change the code and send me a pull request, i'll be more happy to accept that- as i tried few things before and was unable to test.

@npenin i have changed the dependency package.
can you test if its working ?

It is still not working. Please tell me how I can help.

I cant test in proxy environment as i dont have one. you can download the code and run the folder from visual studio code and test it out manually and send me pull request, i will be more happy to accept that

Hello - could you please provide a way we could manually sync by copy pasting this file? Gist doesn't work behind proxy.

Hi @shanalikhan, to solve this problem, just add proxy into options when you create node-github instance, like:

new GitHubApi({ proxy: "http://127.0.0.1:1080" // ss proxy for example. })

as the node-github is using https-proxy-agent to handle proxy in its httpSend function which is used to handle Gist/GitHub api.

So, you can just save proxy settings into syncSettings.json file, and read it when your ext is activated.

I've tested in my syncing ext and it worked well. Hope this would help!

@piggyslasher this could be another option to save it rather in file rather then GIST and use it instead of GIST. i think you should open a seperate issue for that for we will see what can be done.

@nonoroazoro Great! thanks for suggesting, i will do it

@shanalikhan :smile:
It seems that this only solve the Gist proxy issue, but yes you can also use https-proxy-agent with https module to solve the same problem in your Util.HttpPostJson function :smiley:

Here's an example:

var https = require("https");
var HttpsProxyAgent = require("https-proxy-agent");
var proxy = "http://127.0.0.1:1080";
var agent = new HttpsProxyAgent(proxy);

// then add this agent into your options file like:
var options: https.RequestOptions = {
    host: item.hostname,
    port: +item.port,
    path: item.path,
    method: 'POST',
    headers: newHeader,
    agent: agent
};

I found this solution here reference.

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.

@kwaxi It's a nice idea. In fact, I took some time to write a new sync extension (called Syncing)... with proxy supported. :smiling_imp:
I've tested it in my Win 7 system, but don't have time to test in Linux/Mac yet...

@nonoroazoro Great to know you are working also. You can send me a pull request rather than developing new extension :) i will be more happy to accept that.

Or provides issues list due to which you have decided to develop new extension (from this Update) as i have seen your comment on other issues page 馃槃

@shanalikhan I'm sorry for that. I mean no offense, just wanna do some practice... :), and thanks a lot for your great work, it did help me a lot.

@nonoroazoro - can you please make a PR? Pull-request. Help the community :)

@piggyslasher I'm sorry but Syncing is a completely new one, can't make any PR...

@piggyslasher i have accepted the request but as mentioned by @nonoroazoro there is another file that needs to be configured to make it fully proxy enabled . Util.HttpPostJson - i will check using fiddler.

i have just commited the patch supporting proxy.
There is some problem in using fiddler for proxy

Can anyone please download the code from the repo and test on proxy server and let me know so i will push the update in store.

I have published the 2.3.4 version with proxy support.

On the latest v2.3.8 proxy settings are still synchronized!

@evil-shrike yes but some users still reports proxy support not fully integrated at https://github.com/shanalikhan/code-settings-sync/issues/135

@shanalikhan not sure I understand. Is it possible to exclude proxy settings from synchronization?

Actually i reference the issue in which users are unable to download the extension behind proxy and i was unable to reproduce the issue from my side (#135)

Anyway No, for now its not possible to exclude proxy settings from synchronization process- i closed that issue https://github.com/shanalikhan/code-settings-sync/issues/100 time ago, i think by adding proxy support again and again , this feature should be added to ignore some settings from sync process.

I works if you define the http_proxy as user environment variable in windows (something like http://username:password@proxyip:port), so your settings can easily be shared

opened a ticket about current proxy limitation #463

In my ubuntu 16.04, I set export HTTP_PROXY=http:127.0.0.1:port and export HTTPS_PROXY=https:127.0.0.1:port in .bashrc and settings sync will show no internet connection...

After I unset these proxy, everything is OK now

I am using version 2.9.0 with vscode insider version 1.20.0-insider

problem not solved ?

Was this page helpful?
0 / 5 - 0 ratings