Skip to content

Commit 37d8564

Browse files
authored
fix: handle cdk error mapping for more generic invalid credentials (#2279)
1 parent 65abf6a commit 37d8564

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

.changeset/fair-ghosts-wave.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+
handle cdk error mapping for more generic invalid credentials

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ const testErrorMappings = [
3131
expectedDownstreamErrorMessage:
3232
'Error: The security token included in the request is expired',
3333
},
34+
{
35+
errorMessage:
36+
'InvalidClientTokenId: The security token included in the request is invalid',
37+
expectedTopLevelErrorMessage:
38+
'The security token included in the request is invalid.',
39+
errorName: 'ExpiredTokenError',
40+
expectedDownstreamErrorMessage:
41+
'InvalidClientTokenId: The security token included in the request is invalid',
42+
},
3443
{
3544
errorMessage: 'Access Denied',
3645
expectedTopLevelErrorMessage:

packages/backend-deployer/src/cdk_error_mapper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export class CdkErrorMapper {
9999
}> => [
100100
{
101101
errorRegex:
102-
/ExpiredToken|Error: The security token included in the request is expired/,
102+
/ExpiredToken|(Error|InvalidClientTokenId): The security token included in the request is (expired|invalid)/,
103103
humanReadableErrorMessage:
104104
'The security token included in the request is invalid.',
105105
resolutionMessage:

0 commit comments

Comments
 (0)