Skip to content

Commit

Permalink
fix: narrow the error parsing for ExpiredToken regex (#2298)
Browse files Browse the repository at this point in the history
  • Loading branch information
Amplifiyer authored Dec 5, 2024
1 parent e0e62bd commit a406263
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/curly-trainers-look.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@aws-amplify/backend-deployer': patch
---

Narrow the error parsing for ExpiredToken regex
6 changes: 4 additions & 2 deletions packages/backend-deployer/src/cdk_error_mapper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@ const testErrorMappings = [
expectedDownstreamErrorMessage: undefined,
},
{
errorMessage: 'ExpiredToken',
errorMessage:
'ExpiredToken: The security token included in the request is expired',
expectedTopLevelErrorMessage:
'The security token included in the request is invalid.',
errorName: 'ExpiredTokenError',
expectedDownstreamErrorMessage: 'ExpiredToken',
expectedDownstreamErrorMessage:
'ExpiredToken: The security token included in the request is expired',
},
{
errorMessage:
Expand Down
2 changes: 1 addition & 1 deletion packages/backend-deployer/src/cdk_error_mapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export class CdkErrorMapper {
}> => [
{
errorRegex:
/ExpiredToken|(Error|InvalidClientTokenId): The security token included in the request is (expired|invalid)/,
/ExpiredToken: .*|(Error|InvalidClientTokenId): The security token included in the request is (expired|invalid)/,
humanReadableErrorMessage:
'The security token included in the request is invalid.',
resolutionMessage:
Expand Down

0 comments on commit a406263

Please sign in to comment.