You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Connection timeout is incorrectly reported as invalid token #8293
Connect timeout is incorrectly reported as invalid token
Steps to reproduce the behavior
Authenticate to a GHE host (eg: ghe.mycorp.org) on the VPN, then disconnect from the VPN
Note that the connection now times out, eg:
❯ curl --connect-timeout 5 https://ghe.mycorp.org
curl: (28) Failed to connect to ghe.mycorp.org port 443 after 2005 ms: Timeout was reached
Check auth status, eg:
❯ gh auth status -h ghe.mycorp.org
ghe.mycorp.org
X ghe.mycorp.org: authentication failed
- The ghe.mycorp.org token in keyring is invalid.
- To re-authenticate, run: gh auth login -h ghe.mycorp.org
- To forget about this host, run: gh auth logout -h ghe.mycorp.org
Expected vs actual behavior
Connection timeouts should be reported as connection timeout rather than an invalid token. An invalid token suggests reauthentication is required, when the solution is to resolve the connection timeout (eg: by connecting to the VPN).
Logs
❯ gh --version
gh version 2.38.0 (2023-11-01)
https://github.com/cli/cli/releases/tag/v2.38.0
@tekumara Thanks for writing in. You are correct that when we encounter an http error gh auth status we automatically assume it is in invalid token even in other cases such as network timeouts. We can definitely improve the messaging in this case to indicate to the user that we were unable to make a connection rather than the current invalid token message. Here is where we currently output the invalid token message and where we should start doing some validation about the type of error that occurred.
Activity
samcoe commentedon Nov 6, 2023
@tekumara Thanks for writing in. You are correct that when we encounter an http error
gh auth statuswe automatically assume it is in invalid token even in other cases such as network timeouts. We can definitely improve the messaging in this case to indicate to the user that we were unable to make a connection rather than the current invalid token message. Here is where we currently output the invalid token message and where we should start doing some validation about the type of error that occurred.mateusmarquezini commentedon Nov 14, 2023
Hi there @samcoe, is someone already looking into this? I'd like to give it a try. Thanks!
samcoe commentedon Nov 15, 2023
@mateusmarquezini I do not believe there are any open PRs for this bug, go for it 👍
mateusmarquezini commentedon Nov 15, 2023
Awesome, thanks @samcoe !
tal66 commentedon Nov 15, 2023
sorry mateusmarquezini, just now seen your comment after already submiting a pr (i had the tab open from a day before).
Revert "refactor: ssh - better messages"