Skip to content

feat: add version-aware AWS CLI guidance to credential error messages#452

Open
siwachabhi wants to merge 1 commit intoaws:mainfrom
siwachabhi:aws-cli-version-guidance
Open

feat: add version-aware AWS CLI guidance to credential error messages#452
siwachabhi wants to merge 1 commit intoaws:mainfrom
siwachabhi:aws-cli-version-guidance

Conversation

@siwachabhi
Copy link

Summary

  • Credential error messages (expired, invalid, missing) now include version-aware guidance instead of hardcoded aws login strings
  • When AWS CLI is not installed or below v2.32.0 (minimum for aws login), users see install/upgrade instructions with a link to the official docs
  • Updates stale aws sso login reference to aws login in the pre-deploy identity flow

Changes

File What changed
src/cli/external-requirements/versions.ts Added AWS_CLI_MIN_VERSION (2.32.0) constant
src/cli/external-requirements/checks.ts Added checkAwsCliVersion(), getAwsLoginGuidance() (cached), and parseAwsCliVersion() — follows existing checkNodeVersion pattern
src/cli/external-requirements/index.ts Re-exported new symbols
src/cli/aws/account.ts Replaced 3 hardcoded 'Run: aws login' strings with dynamic await getAwsLoginGuidance()
src/cli/operations/deploy/pre-deploy-identity.ts Changed 'aws sso login''aws login'

Motivation

Users with older AWS CLI versions (< 2.32.0) see Run: aws login in error messages, but aws login doesn't exist in their version. This leads to confusion — they try the command, it fails, and they don't know why. The new guidance detects the installed CLI version and tells users exactly what to do:

  • Not installed: "1. Install AWS CLI (v2.32.0+): [link] 2. Run: aws login"
  • Old version: "1. Update AWS CLI from vX.Y.Z to v2.32.0+: [link] 2. Run: aws login"
  • Current version: "Run: aws login"

Test plan

  • All 112 unit tests in checks.test.ts, versions.test.ts, detect.test.ts, account.test.ts, pre-deploy-identity.test.ts pass
  • npx tsc --noEmit passes
  • Prettier + ESLint + secretlint pass (pre-commit hooks)
  • Manual: run agentcore deploy with expired creds and verify guidance message
  • Manual: run with AWS CLI < 2.32.0 and verify upgrade guidance appears

@siwachabhi siwachabhi requested a review from a team February 25, 2026 20:29
@github-actions github-actions bot added the size/m PR size: M label Feb 25, 2026
@siwachabhi siwachabhi changed the title feat: version-aware AWS CLI guidance in credential errors feat: add version-aware AWS CLI guidance to credential error messages Feb 25, 2026
@github-actions github-actions bot added size/s PR size: S and removed size/m PR size: M labels Feb 25, 2026
@siwachabhi siwachabhi force-pushed the aws-cli-version-guidance branch from d7b4f37 to fd201a2 Compare February 25, 2026 20:36
@github-actions github-actions bot added size/s PR size: S and removed size/s PR size: S labels Feb 25, 2026
@siwachabhi siwachabhi force-pushed the aws-cli-version-guidance branch from fd201a2 to 9655e0a Compare February 25, 2026 20:39
@github-actions github-actions bot added size/s PR size: S and removed size/s PR size: S labels Feb 25, 2026
let errorMessage: string;
if (isNoCredentialsError(error)) {
errorMessage = 'AWS credentials not found. Run `aws sso login` or set AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY.';
errorMessage = 'AWS credentials not found. Run `aws login` to authenticate.';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should also use getAwsLoginGuidance() for consistency, right? The function is already async, so it could just be:

  errorMessage = `AWS credentials not found. ${await getAwsLoginGuidance()}`;

Credential error messages now include contextual AWS CLI guidance
instead of hardcoded "Run: aws login" strings. When the CLI is
missing or below v2.32.0, users see install/upgrade instructions
inline — the overall message structure stays the same.

Also updates stale "aws sso login" reference to "aws login" in
pre-deploy identity flow.
@siwachabhi siwachabhi force-pushed the aws-cli-version-guidance branch from 9655e0a to f95fe46 Compare February 25, 2026 21:44
@github-actions github-actions bot added size/s PR size: S and removed size/s PR size: S labels Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/s PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants