Skip to content

Commit 754d0f7

Browse files
fix: map another form of access denied validation error (#2261)
* fix: map another form of access denied validation error * Update .changeset/healthy-trains-doubt.md Co-authored-by: Roshane Pascual <[email protected]> --------- Co-authored-by: Roshane Pascual <[email protected]>
1 parent a23f656 commit 754d0f7

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

.changeset/healthy-trains-doubt.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+
map another form of access denied validation error

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,13 @@ npm error A complete log of this run can be found in: /home/some-path/.npm/_logs
406406
errorName: 'AccessDeniedError',
407407
expectedDownstreamErrorMessage: undefined,
408408
},
409+
{
410+
errorMessage: `User: some:great:user is not authorized to perform: appsync:StartSchemaCreation on resource: arn:aws:appsync:us-east-1:235494812930:/v1/api/myApi`,
411+
expectedTopLevelErrorMessage:
412+
'Unable to deploy due to insufficient permissions',
413+
errorName: 'AccessDeniedError',
414+
expectedDownstreamErrorMessage: undefined,
415+
},
409416
{
410417
errorMessage:
411418
`Error: Transform failed with 1 error:` +

packages/backend-deployer/src/cdk_error_mapper.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,16 @@ export class CdkErrorMapper {
221221
errorName: 'AccessDeniedError',
222222
classification: 'ERROR',
223223
},
224+
{
225+
errorRegex:
226+
/User:(.*) is not authorized to perform:(?<action>.*) on resource:(?<resource>.*)/,
227+
humanReadableErrorMessage:
228+
'Unable to deploy due to insufficient permissions',
229+
resolutionMessage:
230+
'Ensure you have permissions to call {action} for {resource}',
231+
errorName: 'AccessDeniedError',
232+
classification: 'ERROR',
233+
},
224234
{
225235
// Also extracts the first line in the stack where the error happened
226236
errorRegex: new RegExp(

0 commit comments

Comments
 (0)