Skip to content

Commit a406263

Browse files
authored
fix: narrow the error parsing for ExpiredToken regex (#2298)
1 parent e0e62bd commit a406263

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

.changeset/curly-trainers-look.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+
Narrow the error parsing for ExpiredToken regex

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@ const testErrorMappings = [
1616
expectedDownstreamErrorMessage: undefined,
1717
},
1818
{
19-
errorMessage: 'ExpiredToken',
19+
errorMessage:
20+
'ExpiredToken: The security token included in the request is expired',
2021
expectedTopLevelErrorMessage:
2122
'The security token included in the request is invalid.',
2223
errorName: 'ExpiredTokenError',
23-
expectedDownstreamErrorMessage: 'ExpiredToken',
24+
expectedDownstreamErrorMessage:
25+
'ExpiredToken: The security token included in the request is expired',
2426
},
2527
{
2628
errorMessage:

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|InvalidClientTokenId): The security token included in the request is (expired|invalid)/,
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)