Possible issue with Network Proxy settings
The sudo gh net start command gives the following error:
choosing codespace: error getting codespaces: error making request: Get "https://api.github.com/user/codespaces?per_page=100": dial tcp 140.82.113.5:443: i/o timeout
Reproduce steps
- From my desktop, connect to my private enterprise network using a
VPNclient (Cisco AnyConnect4.10.01075). - Configure required enterprise
proxysettings through theHTTP_PROXY,HTTPS_PROXYandNO_PROXYenvironment variables. -
Optional: run
gh codespace listto make sureproxysettings are configured properly. - Run
sudo gh net start. The command will fail with the error message provided above.
Expected behavior
The sudo gh net start command should display the list of codespaces to choose from successfully.
Desktop:
- OS: macOS
- Version 12.5
- Platform architecture: Apple M1
-
ghversion2.14.3(2022-07-26)
Additional context
The sudo gh net start command successfully displays the list of codespaces when NOT connected to VPN.
@C1aud3 thanks for reporting this! Can you try connecting to the Codespace with SSH?
[sudo] gh codespace ssh
This should give us an idea if this is GH CLI issue or not.
Also mind trying the gh codespace list with sudo, e.g. sudo gh codespace list?
Thanks!
@C1aud3 thanks for reporting this! Can you try connecting to the Codespace with
SSH?[sudo] gh codespace sshThis should give us an idea if this is
GH CLIissue or not.Also mind trying the
gh codespace listwithsudo, e.g.sudo gh codespace list?Thanks!
Hi @legomushroom ! The results are below. It looks like using sudo is causing issues.
-
gh codespace list: works fine ✅ -
sudo gh codespace list: ❌ Fails with the following error:
- choosing codespace: error getting codespaces: error making request: Get "https://api.github.com/user/codespaces?per_page=100": dial tcp 140.82.113.5:443: i/o timeout
-
gh codespace ssh: works fine ✅ -
sudo gh codespace ssh: ❌ Fails with the following error:
choosing codespace: error getting codespaces: error making request: Get "https://api.github.com/user/codespaces?per_page=100": dial tcp 140.82.112.6:443: i/o timeout
@C1aud3 thanks for testing this!
Wondering if that is a credentials issue, mind trying this:
-
gh auth status -t-> copy the token -
sudo gh auth logout -
echo {TOKEN} | sudo gh auth login --with-token - Try connecting to a Codespace again(with
sudo) 🤞
We will remove the sudo requirement in the next extension release 🚀
Hi @legomushroom, unfortunately it didn't seem to solve the issue. Here's what I got:
-
gh auth status -t-> copy the token : ✅ -
sudo gh auth logout: ✅ Note: The command works withsudobut takes over 30 seconds to execute. Running the command withoutsudoexecutes instantly. -
echo {TOKEN} | sudo gh auth login --with-token: ❌
- Fails with:
error validating token: Get "https://api.github.com/": dial tcp 140.82.114.6:443: i/o timeout - To proceed further, I had to login without using
sudo
- Try connecting to a Codespace again(with
sudo): ❌
- Fails with the same
dial tcp 140.82.112.5:443: i/o timeouterror.
Hopefully the upcoming removal of the sudo requirement resolves this 🤞
@legomushroom I confirm I'm still having the issue with the latest version of the plugin and running the gh net start command without sudo:
gh net start
Password:
choosing codespace: error getting codespaces: error making request: Get "https://api.github.com/user/codespaces?per_page=100": dial tcp 140.82.113.5:443: i/o timeout
Plugin version:
gh --version && gh extension list
gh version 2.14.7 (2022-08-25)
https://github.com/cli/cli/releases/tag/v2.14.7
gh net github/gh-net v0.12.2
@C1aud3 mind trying this custom dev0.12.5-beta1 build? You can install it like this:
gh extension install legomushroom/gh-net
Thanks!
@C1aud3 mind trying this custom
dev0.12.5-beta1build? You can install it like this:gh extension install legomushroom/gh-netThanks!
I'll try to test this a little bit more extensively this week, but a quick test this morning allowed me to successfully list codespaces, select one and connect to it without any error messages. 🎉
@C1aud3 thanks for trying it out! Looks like the issue was in missing some of the environment variables.
When we escalate to the root, we allow only few env variables to be inherited for the new escalated process. The custom build you've tried out is the same as released 0.12.4 but now allows for all env vars to be inherited by the new process.Do you know if your proxy setup use any env variables?
Hi @legomushroom , thanks for the fix! Yes, my proxy setup uses env variables. As per my original posting:
Configure required enterprise proxy settings through the HTTP_PROXY, HTTPS_PROXY and NO_PROXY environment variables.
Hi @legomushroom, I'm working with @C1aud3. Do you have any idea of when this fix will be officially released?