`agentcore dev` container fails with LoginTokenLoadError when using `aws login` credentials
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 80/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- aws, docker, typescript
- Lĩnh vực
- authentication, cli
Hướng nghiên cứu
Bắt đầu từ ContainerDevRunner.run(), nơi CLI đặt AWS_CONFIG_FILE và AWS_SHARED_CREDENTIALS_FILE trong môi trường được chuyển tiếp vào container. Kiểm tra xem môi trường của container có được xây dựng ở một nơi duy nhất hay không và xem đã có test nào khẳng định các biến được chuyển tiếp đó chưa. Hoàn thành khi container nhận được AWS_LOGIN_CACHE_DIRECTORY trỏ tới /aws-config/login/cache và có một test bao phủ giá trị đó.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
When running a Container-build agent with agentcore dev using aws login credentials (IAM Identity Center login_session), the agent fails with LoginTokenLoadError on every invocation — even immediately after a successful aws login.
The CLI mounts ~/.aws into the container at /aws-config and sets AWS_CONFIG_FILE=/aws-config/config, but does not set AWS_LOGIN_CACHE_DIRECTORY. The botocore login credential provider ignores AWS_CONFIG_FILE and resolves the token cache path independently via ~/.aws/login/cache, which expands to /home/bedrock_agentcore/.aws/login/cache inside the container — a path that does not exist.
Steps to Reproduce
- Authenticate with
aws login - Run
agentcore devfor a Container-build agent - Invoke the agent
Expected Behavior
The agent resolves AWS credentials successfully using the token cached by aws login, matching the behavior seen in CodeZip-build agents.
Actual Behavior
The agent fails immediately with:
botocore.exceptions.LoginTokenLoadError: Error loading login session token:
Unable to load a existing login session for session
arn:aws:iam::<account>:user/<user>.
Please reauthenticate with 'aws login'.
This happens even when the token is freshly issued and not expired.
CLI Version
1.0.0-rc.5
Operating System
macOS
Additional Context
Root cause: In ContainerDevRunner.run(), the CLI sets:
forwardedEnv.AWS_CONFIG_FILE = "/aws-config/config"
forwardedEnv.AWS_SHARED_CREDENTIALS_FILE = "/aws-config/credentials"
But AWS_LOGIN_CACHE_DIRECTORY is not forwarded. Botocore resolves the login token cache in botocore/utils.py::get_login_token_cache_directory():
def get_login_token_cache_directory():
if 'AWS_LOGIN_CACHE_DIRECTORY' in os.environ:
return os.path.expanduser(os.environ['AWS_LOGIN_CACHE_DIRECTORY'])
else:
return os.path.expanduser(os.path.join('~', '.aws', 'login', 'cache'))
AWS_CONFIG_FILE has no effect on this path. The token cache is present at /aws-config/login/cache inside the container but the provider looks for it at ~/.aws/login/cache (/home/bedrock_agentcore/.aws/login/cache), which doesn't exist.
Fix: Add one line alongside the existing forwarded env vars:
forwardedEnv.AWS_LOGIN_CACHE_DIRECTORY = "/aws-config/login/cache"
Workaround (entrypoint script):
if [ -n "$AWS_CONFIG_FILE" ]; then
export AWS_LOGIN_CACHE_DIRECTORY="$(dirname "$AWS_CONFIG_FILE")/login/cache"
fi
- Ngôn ngữ chính
- TypeScript
- Star
- 304
- Fork
- 105
- Merge trung bình
- 16 giờ 14 phút
- Pull request đã merge (30 ngày)
- 186
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của aws/agentcore-cli
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
aws/agentcore-cli#2538 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Refactor] project add credentials payment does not match Connector regexCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
aws/agentcore-cli#2533 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
aws/agentcore-cli#2520 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug(policy): add policy --target generates an undeployable Cedar statement (wrong action id suffix, resource scope not narrowed)Có thể đã có người làm @rksharma-owg đã nhận 19 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
aws/agentcore-cli#2395 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ci: skip CI jobs for release commitsCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
aws/agentcore-cli#2392 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của aws/agentcore-cli
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Chocobozzz/PeerTube#7832 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Pay to use?Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 66/100
darkreader/darkreader#16108 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Add: Dak Nong TV SDĐang mởcheck:passed streams:add
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug engine
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
frostney/GocciaScript#1746 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
agilepathway/label-checker#739 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày