CLI does not work in codespaces/devcontainers
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 807
- Avg merge
- 10h 12m
- Merged PRs (30d)
- 7
Description
## Problem
## Steps to reproduce the issue
1. Build codespaces with following `devcontainer.json`:
```json
{
"image": "mcr.microsoft.com/devcontainers/universal:2",
"features": {
"ghcr.io/devcontainers/features/aws-cli:1": {}
}
}
```
2. Install this extension
3. Login with SSO
4. Make sure you are logged in with SSO account and can access resources in UI
5. Open terminal
6. Execute any cli command such as `aws sts get-caller-identity`
```
$ aws sts get-caller-identity
```
## Expected behavior
CLI works
## System details (run `AWS: About` and/or `Amazon Q: About`)
- OS: Linux x64 6.5.0-1022-azure
- Visual Studio Code extension host: 1.92.0
- AWS Toolkit: 3.18.0
- node: 20.14.0
- CLI: aws-cli/2.17.21 Python/3.11.9 Linux/6.5.0-1022-azure exe/x86_64.ubuntu.20
- Amazon Q version: none
## Additional information
```
$ find ~/.aws/ -type f
/home/codespace/.aws/sso/cache/4f6463411d78d100143509e568db965f1b94bc39.json
/home/codespace/.aws/sso/cache/aws-toolkit-vscode-client-id-us-east-1-1f38e0f8ee2c5a17b5a7e476ce8539fcaf57f036212f75c5b66e04055f1d4f83.json
```
```
$ aws sts get-caller-identity --debug
2024-08-02 00:58:19,412 - MainThread - awscli.clidriver - DEBUG - CLI version: aws-cli/2.17.21 Python/3.11.9 Linux/6.5.0-1022-azure exe/x86_64.ubuntu.20
2024-08-02 00:58:19,412 - MainThread - awscli.clidriver - DEBUG - Arguments entered to CLI: ['sts', 'get-caller-identity', '--debug']
2024-08-02 00:58:19,425 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler
2024-08-02 00:58:19,426 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler
2024-08-02 00:58:19,426 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler >
2024-08-02 00:58:19,426 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler
2024-08-02 00:58:19,426 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler
2024-08-02 00:58:19,426 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler
2024-08-02 00:58:19,426 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler
2024-08-02 00:58:19,426 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler >
2024-08-02 00:58:19,426 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler
2024-08-02 00:58:19,426 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler >
2024-08-02 00:58:19,426 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/local/aws-cli/v2/2.17.21/dist/awscli/data/cli.json
2024-08-02 00:58:19,428 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler
2024-08-02 00:58:19,428 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler
2024-08-02 00:58:19,428 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler
2024-08-02 00:58:19,428 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler
2024-08-02 00:58:19,428 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler
2024-08-02 00:58:19,429 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler
2024-08-02 00:58:19,429 - MainThread - awscli.clidriver - DEBUG - CLI version: aws-cli/2.17.21 Python/3.11.9 Linux/6.5.0-1022-azure exe/x86_64.ubuntu.20
2024-08-02 00:58:19,429 - MainThread - awscli.clidriver - DEBUG - Arguments entered to CLI: ['sts', 'get-caller-identity', '--debug']
2024-08-02 00:58:19,429 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler
2024-08-02 00:58:19,429 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler
2024-08-02 00:58:19,429 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler
2024-08-02 00:58:19,430 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler
2024-08-02 00:58:19,430 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler
2024-08-02 00:58:19,431 - MainThread - botocore.utils - DEBUG - IMDS ENDPOINT: http://169.254.169.254/
2024-08-02 00:58:19,432 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler
2024-08-02 00:58:19,432 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler
2024-08-02 00:58:19,446 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/local/aws-cli/v2/2.17.21/dist/awscli/botocore/data/sts/2011-06-15/service-2.json
2024-08-02 00:58:19,448 - MainThread - botocore.hooks - DEBUG - Event building-command-table.sts: calling handler
2024-08-02 00:58:19,463 - MainThread - botocore.hooks - DEBUG - Event building-command-table.sts: calling handler >
2024-08-02 00:58:19,463 - MainThread - awscli.clidriver - DEBUG - OrderedDict()
2024-08-02 00:58:19,464 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.sts.get-caller-identity: calling handler
2024-08-02 00:58:19,464 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.sts.get-caller-identity: calling handler
2024-08-02 00:58:19,464 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.sts.get-caller-identity: calling handler
2024-08-02 00:58:19,464 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.sts.get-caller-identity: calling handler
2024-08-02 00:58:19,478 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/local/aws-cli/v2/2.17.21/dist/awscli/botocore/data/sts/2011-06-15/paginators-1.json
2024-08-02 00:58:19,478 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.sts.get-caller-identity: calling handler
2024-08-02 00:58:19,479 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.sts.get-caller-identity: calling handler >
2024-08-02 00:58:19,479 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.sts.get-caller-identity: calling handler >
2024-08-02 00:58:19,479 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.sts.get-caller-identity: calling handler >
2024-08-02 00:58:19,479 - MainThread - botocore.hooks - DEBUG - Event building-command-table.sts_get-caller-identity: calling handler
2024-08-02 00:58:19,479 - MainThread - botocore.hooks - DEBUG - Event building-command-table.sts_get-caller-identity: calling handler >
2024-08-02 00:58:19,479 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.sts.get-caller-identity.cli-input-json: calling handler
2024-08-02 00:58:19,479 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.sts.get-caller-identity.cli-input-yaml: calling handler
2024-08-02 00:58:19,480 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.sts.get-caller-identity.generate-cli-skeleton: calling handler
2024-08-02 00:58:19,480 - MainThread - botocore.hooks - DEBUG - Event calling-command.sts.get-caller-identity: calling handler >
2024-08-02 00:58:19,480 - MainThread - botocore.hooks - DEBUG - Event calling-command.sts.get-caller-identity: calling handler >
2024-08-02 00:58:19,480 - MainThread - botocore.hooks - DEBUG - Event calling-command.sts.get-caller-identity: calling handler >
2024-08-02 00:58:19,480 - MainThread - botocore.utils - DEBUG - IMDS ENDPOINT: http://169.254.169.254/
2024-08-02 00:58:19,481 - MainThread - urllib3.connectionpool - DEBUG - Starting new HTTP connection (1): 169.254.169.254:80
2024-08-02 00:58:19,504 - MainThread - urllib3.connectionpool - DEBUG - http://169.254.169.254:80 "PUT /latest/api/token HTTP/1.1" 400 322
2024-08-02 00:58:19,504 - MainThread - awscli.clidriver - DEBUG - Exception caught in main()
Traceback (most recent call last):
File "awscli/clidriver.py", line 499, in main
File "awscli/clidriver.py", line 634, in __call__
File "awscli/clidriver.py", line 837, in __call__
File "awscli/clidriver.py", line 959, in invoke
File "awscli/botocore/session.py", line 825, in create_client
File "awscli/botocore/session.py", line 890, in _resolve_region_name
File "awscli/botocore/session.py", line 265, in get_config_variable
File "awscli/botocore/configprovider.py", line 350, in get_config_variable
File "awscli/botocore/configprovider.py", line 468, in provide
File "awscli/utils.py", line 115, in provide
File "awscli/utils.py", line 120, in _get_instance_metadata_region
File "awscli/utils.py", line 171, in retrieve_region
File "awscli/utils.py", line 180, in _get_region
File "awscli/botocore/utils.py", line 392, in _fetch_metadata_token
botocore.utils.BadIMDSRequestError:
```
Contributor guide
Research direction
No source files or tests are named. Reproduce the issue using the supplied devcontainer.json, SSO login, and `aws sts get-caller-identity`; use `--debug` and the `AWS: About` entry point to compare the CLI failure with the extension state. Done means the CLI command works in the described Codespaces/devcontainer setup.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript, vscode
- Domain
- authentication, cli, cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100