Skip to content

Commit d7b4f37

Browse files
author
Abhimanyu Siwach
committed
fix: preserve original error messages for invalid/missing credentials
Restore the "Check your env vars" hint for InvalidClientTokenId and the "Or set env vars" fallback for no-credentials case. Dynamic version-aware guidance is only used for expired credentials where users are most likely to need aws login instructions.
1 parent be19146 commit d7b4f37

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

src/cli/aws/account.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,9 @@ export async function detectAccount(): Promise<string | null> {
5555
}
5656

5757
if (code === 'InvalidClientTokenId' || code === 'SignatureDoesNotMatch') {
58-
const guidance = await getAwsLoginGuidance();
5958
throw new AwsCredentialsError(
6059
'AWS credentials are invalid.',
61-
`AWS credentials are invalid.\n\nTo fix this:\n ${guidance}`
60+
'AWS credentials are invalid.\n\nTo fix this:\n 1. Check your AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY\n 2. Or run: aws login'
6261
);
6362
}
6463

@@ -83,7 +82,7 @@ export async function validateAwsCredentials(): Promise<void> {
8382
const guidance = await getAwsLoginGuidance();
8483
throw new AwsCredentialsError(
8584
'No AWS credentials configured.',
86-
`No AWS credentials configured.\n\nTo fix this:\n ${guidance}`
85+
`No AWS credentials configured.\n\nTo fix this:\n ${guidance}\n Or set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables`
8786
);
8887
}
8988
}

0 commit comments

Comments
 (0)