Skip to content

Authentication fails with 'TypeError: Invalid URL' even when http.proxySupport is "off" #1159

@wei-hr

Description

@wei-hr

Describe the bug
The Gemini Code Assist extension fails to authenticate when system environment variables http_proxy or https.proxy are set without a protocol prefix (e.g., 127.0.0.1:7890). The authentication process crashes with a TypeError: Invalid URL.

Crucially, this error persists even when VS Code's http.proxySupport setting is set to "off", which should prevent the extension from using system proxies altogether.

To Reproduce

On a remote Linux server, set the following environment variables in a shell startup file (e.g., .bashrc):

Bash

export http_proxy=127.0.0.1:7890
export https_proxy=127.0.0.1:7890
Connect to the server using VS Code Remote-SSH.

Set "http.proxySupport": "off" in the remote settings.json to disable proxy usage.

Attempt to sign in to the Gemini Code Assist extension.

The authentication process fails with the TypeError: Invalid URL error.

Expected behavior
The extension should either:
a) Correctly handle proxy strings without a protocol, or
b) Respect the "http.proxySupport": "off" setting and bypass the system proxy, allowing authentication to succeed (as direct internet connection is available, confirmed via curl).

Logs

[error] [Extension Host] Error passing exchange token to oauth processor TypeError: Invalid URL
at new URL (node:internal/url:806:29)
at new f (/home/whr/.vscode-server/extensions/google.geminicodeassist-2.47.0/dist/extension.js:2:4972182)
at T.c (/home/whr/.vscode-server/extensions/google.geminicodeassist-2.47.0/dist/extension.js:2:4967421)
at async T.request (/home/whr/.vscode-server/extensions/google.geminicodeassist-2.47.0/dist/extension.js:2:4962413)
at async m.getTokenAsync (/home/whr/.vscode-server/extensions/google.geminicodeassist-2.47.0/dist/extension.js:2:4922636)
at async t.OAuthProvider.processAuthToken (/home/whr/.vscode-server/extensions/google.geminicodeassist-2.47.0/dist/extension.js:2:14182605)
System information

OS: []

VS Code version: [1.98]

Gemini Code Assist extension version: 2.47.0

Additional context

The remote server has direct internet access. curl https://www.google.com works without a proxy.

The root cause is the incorrectly formatted proxy environment variable. Correcting it to http://127.0.0.1:7890 permanently fixes the issue.

The main point of this bug report is that the extension does not respect "http.proxySupport": "off", which makes troubleshooting very difficult.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions