Skip to content

web_fetch and auto-update fail with TypeError: fetch failed behind corporate proxy #2395

@mu88

Description

@mu88

Describe the bug

On Windows behind a corporate HTTP proxy, web_fetch and auto-update fail with
TypeError: fetch failed, even when HTTP_PROXY and HTTPS_PROXY are set as documented in
copilot help environment. curl.exe through the same proxy works fine, so the proxy itself
is not the issue.

My best guess for the root cause: copilot.exe appears to be a self-contained executable
that may ship with an embedded Node.js runtime. If that runtime is older than v23.8.0, native
fetch (undici) would silently ignore proxy env vars, since NODE_USE_ENV_PROXY=1 support
was only added in v23.8.0. Switching the system Node via nvm has no effect, which is
consistent with this theory — but I'm not certain this is the actual cause.

Affected version

GitHub Copilot CLI 1.0.3 (Installed via MSI from GitHub Releases)

Steps to reproduce the behavior

  1. Set proxy environment variables in PowerShell:
    $env:HTTP_PROXY  = "http://proxy.example.com:3128"
    $env:HTTPS_PROXY = "http://proxy.example.com:3128"
    $env:http_proxy  = "http://proxy.example.com:3128"
    $env:https_proxy = "http://proxy.example.com:3128"
    $env:NODE_USE_ENV_PROXY = "1"
    $env:NODE_USE_SYSTEM_CA = "1"
  2. Verify the proxy works independently:
    curl.exe -x http://proxy.example.com:3128 https://api.github.com  # returns HTTP 200
  3. Start copilotError auto updating: TypeError: fetch failed appears on startup
  4. Ask Copilot to fetch any HTTPS URL via web_fetch — same TypeError: fetch failed

Expected behavior

HTTP_PROXY / HTTPS_PROXY should be respected for all outgoing connections, as documented in copilot help environment.

Additional context

  • Operating system: Windows 11
  • CPU architecture: x86_64
  • Shell: PowerShell 7
  • Terminal: Windows Terminal
  • Installed via: MSI from GitHub Releases
  • nvm use 23.8.0 + restarting copilot has no effect (suggesting the bundled runtime is used regardless of system Node)
  • Potential workaround (untested): a transparent OS-level proxy tool (e.g. Proxifier) that forces copilot.exe connections through the proxy at OS level
  • Related: FR: Support for HTTPS_PROXY (web proxies) #41

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions