Skip to content

VS Code does not use environment variable http_proxy #84845

Closed

Description

@simue

Issue Type: Bug

  1. Go to VS Code settings, section Application>Proxy.

  2. See Proxy setting whose clarification is "The proxy setting to use. If not set, will be inherited from the http_proxy and https_proxy environment variables."

  3. Set environment variable http_proxy.

  4. Do networking stuff. E.g. try to sign in to Azure via Azure Account Extension: Press F1 ">Azure: Sign In".

  5. Get Error notification saying "You appear to be offline. Please check your network connection." which is generated by Azure Account Extension.

  6. Go to Settings.json, set "http.proxy": "http://server:port"

  7. Try to log in again.

  8. Success!

I consider this a Bug, as the help text in the settings dialogue states that environment variables are loaded and used centrally, when they are not.

Further more, it is not the case that proxy settings can't be used by the extension since written directly into the settings.json everything works.

VS Code version: Code 1.40.1 (8795a98, 2019-11-13T16:49:35.976Z)
OS version: Windows_NT x64 10.0.17763

System Info
Item Value
CPUs Intel(R) Xeon(R) CPU E3-1505M v5 @ 2.80GHz (8 x 2808)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off
surface_control: disabled_off
surface_synchronization: enabled_on
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 31.92GB (24.07GB free)
Process Argv
Screen Reader no
VM 0%
Extensions (9)
Extension Author (truncated) Version
python ms- 2019.10.44104
vscode-ai ms- 0.6.7
azure-account ms- 0.8.7
team ms- 1.161.0
azure-iot-edge vsc 1.18.0
azure-iot-toolkit vsc 2.13.0
azure-iot-tools vsc 0.3.0
vscode-iot-device-cube vsc 0.1.4
vscode-iot-workbench vsc 0.10.16

Activity

  1. vscodebot commented on Nov 14, 2019

    @vscodebot

    (Experimental duplicate detection)
    Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

  2. simue commented on Nov 14, 2019

    @simue
    Author

    Based on the observation, that setting the proxy address explicitly via the setting dialogue or in settings.json, I disagree the classification of this Issue as a duplicate.

  3. chrmarti commented on Nov 15, 2019

    @chrmarti
    Collaborator

    Try setting the proxy environment variable and then restart VS Code (if that doesn't work try rebooting the machine after setting the environment variable). We do look at the environment variables, note that if the setting is present, that wins over the environment variables.

  4. added
    info-needed
    proxy
    and removed on Nov 15, 2019
  5. vscodebot commented on Nov 25, 2019

    @vscodebot

    This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

    Happy Coding!

  6. simue commented on Nov 26, 2019

    @simue
    Author

    Thank you for your input!
    I did restart the PC after removing the explicit proxy setting and assuring that the environment variable is set correctly. This did not work. The environment variable was written all uppercase: HTTP_PROXY.
    I then changed it to all lowercase which worked fine.
    Additionally, since my last post here I observed the behaviour of the Sign In. Most of the times it worked, sometimes not. I can not see a pattern there. Maybe it also didn't not work because of the uppercase/lowercase, but because of other reasons (maybe not in relation to VS Code and the Azure plugin)?

    Could you please confirm/disprove the uppercase/lowercase suspicion?

  7. chrmarti commented on Nov 27, 2019

    @chrmarti
    Collaborator

    I read the lower- and uppercase names:

    let envProxy = proxyFromConfigURL(env.https_proxy || env.HTTPS_PROXY || env.http_proxy || env.HTTP_PROXY); // Not standardized.

    Note that the setting wins over the environment variables. So if the setting had an invalid value, that would be tried and not the environment variables.

  8. simue commented on Nov 27, 2019

    @simue
    Author

    The proxy setting was empty.
    Are there any logfiles that one could look into when the error occurs again?

  9. chrmarti commented on Nov 28, 2019

    @chrmarti
    Collaborator

    You can set the log level to Trace (F1 > Developer: Set Log Level...) to get logging in the Output panel's Extension Host channel. Look for lines with 'ProxyResolver#'.

  10. simue commented on Dec 2, 2019

    @simue
    Author

    Will this have to be done after every start of VS Code, or is this a permanent setting?

  11. chrmarti commented on Dec 2, 2019

    @chrmarti
    Collaborator

    The log level is preserved for as long as at least one window is open (or being reloaded).

  12. simue commented on Dec 5, 2019

    @simue
    Author

    Since the problem did, until now, not reoccur, I assume that this issue is related to my company's proxy.
    If the problem reoccurs, I am going to get the logs and get back here.
    Thank you very much for your help!

  13. locked and limited conversation to collaborators on Jan 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

info-neededproxy

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions