-
Notifications
You must be signed in to change notification settings - Fork 8k
Closed
Labels
bugSomething isn't workingSomething isn't workingcodespacesgh-codespacerelating to the gh codespace commandrelating to the gh codespace commandhelp wantedContributions welcomeContributions welcomeplatformProblems with the GitHub platform rather than the CLI clientProblems with the GitHub platform rather than the CLI clientpriority-3Affects a small number of users or is largely cosmeticAffects a small number of users or is largely cosmetic
Description
Describe the bug
GitHub CLI version: v2.32.1
gh cs ssh fails when I give GitHub CLI a fine-grained token with the following permissions:
- Repository permissions
- Codespaces: Read and write
- Codespaces lifecycle admin: Read and write
- Codespaces metadata: Read-only
- Metadata: Read-only
$ gh codespace list # already available codespace
NAME DISPLAY NAME REPOSITORY BRANCH STATE CREATED AT
urban-potato-7ppxvp676q62xr4x urban potato azrsh/dotfiles master Available 2d
$ gh codespace ssh
? Choose codespace: azrsh/dotfiles (master): urban potato
failed to connect to Live Share: timed out while waiting for the codespace to startSteps to reproduce the behavior
- Prepare a fine-grained PAT with the above permissions. Choose an appropriate repository because you need repository permissions.
- Set the
GITHUB_TOKENenvironment variable - Create a Codespace with
gh cs createand wait until it becomes available gh cs sshto the created Codespace
Expected vs actual behavior
The expected behavior here is to successfully connect to the Codespace.
Alternatively, an error message that correctly describes the situation is expected.
But this behavior is neither.
Logs
This is the log when running gh cs ssh with GH_API=debug added to the environment variables.
Details
$ GH_DEBUG=api envwarden gh gh cs ssh -c urban-potato-7ppxvp676q62xr4x
* Request at 2023-08-10 00:42:08.252190171 +0900 JST m=+0.010011890
* Request to https://api.github.com/user/codespaces/urban-potato-7ppxvp676q62xr4x?internal=true&refresh=true
> GET /user/codespaces/urban-potato-7ppxvp676q62xr4x?internal=true&refresh=true HTTP/1.1
> Host: api.github.com
> Accept: application/vnd.github.v3+json
> Authorization: token ████████████████████
> Content-Type: application/json; charset=utf-8
> Time-Zone: Asia/Tokyo
> User-Agent: GitHub CLI v2.32.1
< HTTP/2.0 500 Internal Server Error
< Access-Control-Allow-Origin: *
< Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset
< Content-Length: 0
< Content-Security-Policy: default-src 'none'
< Content-Type: application/json; charset=utf-8
< Date: Wed, 09 Aug 2023 15:44:05 GMT
< Github-Authentication-Token-Expiration: 2023-11-05 17:53:02 +0900
< Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
< Server: GitHub.com
< Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
< Vary: Accept-Encoding, Accept, X-Requested-With
< X-Content-Type-Options: nosniff
< X-Frame-Options: deny
< X-Github-Api-Version-Selected: 2022-11-28
< X-Github-Media-Type: github.v3; format=json
< X-Github-Request-Id: F3C3:167D:F19985:FC4B2C:64D3B444
< X-Ratelimit-Limit: 5000
< X-Ratelimit-Remaining: 4940
< X-Ratelimit-Reset: 1691597281
< X-Ratelimit-Resource: codespaces
< X-Ratelimit-Used: 60
< X-Xss-Protection: 0
* Request took 1.192859448s
* Request at 2023-08-10 00:42:09.54556097 +0900 JST m=+1.303382741
* Request to https://api.github.com/user/codespaces/urban-potato-7ppxvp676q62xr4x?internal=true&refresh=true
> GET /user/codespaces/urban-potato-7ppxvp676q62xr4x?internal=true&refresh=true HTTP/1.1
> Host: api.github.com
> Accept: application/vnd.github.v3+json
> Authorization: token ████████████████████
> Content-Type: application/json; charset=utf-8
> Time-Zone: Asia/Tokyo
> User-Agent: GitHub CLI v2.32.1
< HTTP/2.0 500 Internal Server Error
< Access-Control-Allow-Origin: *
< Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset
< Content-Length: 0
< Content-Security-Policy: default-src 'none'
< Content-Type: application/json; charset=utf-8
< Date: Wed, 09 Aug 2023 15:44:06 GMT
< Github-Authentication-Token-Expiration: 2023-11-05 17:53:02 +0900
< Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
< Server: GitHub.com
< Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
< Vary: Accept-Encoding, Accept, X-Requested-With
< X-Content-Type-Options: nosniff
< X-Frame-Options: deny
< X-Github-Api-Version-Selected: 2022-11-28
< X-Github-Media-Type: github.v3; format=json
< X-Github-Request-Id: F3C3:167D:F199DE:FC4B89:64D3B445
< X-Ratelimit-Limit: 5000
< X-Ratelimit-Remaining: 4939
< X-Ratelimit-Reset: 1691597281
< X-Ratelimit-Resource: codespaces
< X-Ratelimit-Used: 61
< X-Xss-Protection: 0
* Request took 1.2413369s
* Request at 2023-08-10 00:42:10.887392052 +0900 JST m=+2.645213827
* Request to https://api.github.com/user/codespaces/urban-potato-7ppxvp676q62xr4x?internal=true&refresh=true
> GET /user/codespaces/urban-potato-7ppxvp676q62xr4x?internal=true&refresh=true HTTP/1.1
> Host: api.github.com
> Accept: application/vnd.github.v3+json
> Authorization: token ████████████████████
> Content-Type: application/json; charset=utf-8
> Time-Zone: Asia/Tokyo
> User-Agent: GitHub CLI v2.32.1
< HTTP/2.0 500 Internal Server Error
< Access-Control-Allow-Origin: *
< Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset
< Content-Length: 0
< Content-Security-Policy: default-src 'none'
< Content-Type: application/json; charset=utf-8
< Date: Wed, 09 Aug 2023 15:44:08 GMT
< Github-Authentication-Token-Expiration: 2023-11-05 17:53:02 +0900
< Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
< Server: GitHub.com
< Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
< Vary: Accept-Encoding, Accept, X-Requested-With
< X-Content-Type-Options: nosniff
< X-Frame-Options: deny
< X-Github-Api-Version-Selected: 2022-11-28
< X-Github-Media-Type: github.v3; format=json
< X-Github-Request-Id: F3C3:167D:F19A37:FC4BE5:64D3B446
< X-Ratelimit-Limit: 5000
< X-Ratelimit-Remaining: 4938
< X-Ratelimit-Reset: 1691597281
< X-Ratelimit-Resource: codespaces
< X-Ratelimit-Used: 62
< X-Xss-Protection: 0
* Request took 1.223878356s
* Request at 2023-08-10 00:42:12.21174709 +0900 JST m=+3.969568866
* Request to https://api.github.com/user/codespaces/urban-potato-7ppxvp676q62xr4x?internal=true&refresh=true
> GET /user/codespaces/urban-potato-7ppxvp676q62xr4x?internal=true&refresh=true HTTP/1.1
> Host: api.github.com
> Accept: application/vnd.github.v3+json
> Authorization: token ████████████████████
> Content-Type: application/json; charset=utf-8
> Time-Zone: Asia/Tokyo
> User-Agent: GitHub CLI v2.32.1
< HTTP/2.0 500 Internal Server Error
< Access-Control-Allow-Origin: *
< Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset
< Content-Length: 0
< Content-Security-Policy: default-src 'none'
< Content-Type: application/json; charset=utf-8
< Date: Wed, 09 Aug 2023 15:44:09 GMT
< Github-Authentication-Token-Expiration: 2023-11-05 17:53:02 +0900
< Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
< Server: GitHub.com
< Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
< Vary: Accept-Encoding, Accept, X-Requested-With
< X-Content-Type-Options: nosniff
< X-Frame-Options: deny
< X-Github-Api-Version-Selected: 2022-11-28
< X-Github-Media-Type: github.v3; format=json
< X-Github-Request-Id: F3C3:167D:F19A89:FC4C3C:64D3B448
< X-Ratelimit-Limit: 5000
< X-Ratelimit-Remaining: 4937
< X-Ratelimit-Reset: 1691597281
< X-Ratelimit-Resource: codespaces
< X-Ratelimit-Used: 63
< X-Xss-Protection: 0
* Request took 1.301847129s
getting full codespace details: error making request: retryNote
- Setting the
GITHUB_TOKENenvironment variable to the classic PAT is the correct behavior. - Giving the Codespace name from the option
-cto GitHub CLI will display error messages that correctly describe the situationgetting full codespace details: error making request: retry
- Fetching the
/user/codespaces/{codespace_name}API using fine-grained PAT without the query parameterinternal=truewill not return a 500 Internal Server Error. It works fine. - Looking at these behaviors, I think the underlying problem is probably in the GitHub API rather than the GitHub CLI, but I report it here as well.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingcodespacesgh-codespacerelating to the gh codespace commandrelating to the gh codespace commandhelp wantedContributions welcomeContributions welcomeplatformProblems with the GitHub platform rather than the CLI clientProblems with the GitHub platform rather than the CLI clientpriority-3Affects a small number of users or is largely cosmeticAffects a small number of users or is largely cosmetic