Skip to content

Commit 7bf0c64

Browse files
authored
fix(backend-deployer): improve handling of expired AWS credentials (#2185)
1 parent b9575eb commit 7bf0c64

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

.changeset/cool-pumpkins-dream.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@aws-amplify/backend-deployer': patch
3+
---
4+
5+
reclassify as error, UnknownFault, Error: The security token included in the request is expired

packages/backend-deployer/src/cdk_error_mapper.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@ const testErrorMappings = [
2222
errorName: 'ExpiredTokenError',
2323
expectedDownstreamErrorMessage: 'ExpiredToken',
2424
},
25+
{
26+
errorMessage:
27+
'Error: The security token included in the request is expired',
28+
expectedTopLevelErrorMessage:
29+
'The security token included in the request is invalid.',
30+
errorName: 'ExpiredTokenError',
31+
expectedDownstreamErrorMessage:
32+
'Error: The security token included in the request is expired',
33+
},
2534
{
2635
errorMessage: 'Access Denied',
2736
expectedTopLevelErrorMessage:

packages/backend-deployer/src/cdk_error_mapper.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,12 @@ export class CdkErrorMapper {
9090
classification: AmplifyErrorClassification;
9191
}> => [
9292
{
93-
errorRegex: /ExpiredToken/,
93+
errorRegex:
94+
/ExpiredToken|Error: The security token included in the request is expired/,
9495
humanReadableErrorMessage:
9596
'The security token included in the request is invalid.',
96-
resolutionMessage: 'Ensure your local AWS credentials are valid.',
97+
resolutionMessage:
98+
"Please update your AWS credentials. You can do this by running `aws configure` or by updating your AWS credentials file. If you're using temporary credentials, you may need to obtain new ones.",
9799
errorName: 'ExpiredTokenError',
98100
classification: 'ERROR',
99101
},

0 commit comments

Comments
 (0)