Skip to content

Commit d66ab17

Browse files
ShadowCat567Vieltojarvi
andauthored
Mapping for more EPERM errors (#2296)
* catching more EPERM errors * adjust error message to be closer to actual message in test * changeset added --------- Co-authored-by: Vieltojarvi <[email protected]>
1 parent a406263 commit d66ab17

File tree

3 files changed

+41
-2
lines changed

3 files changed

+41
-2
lines changed

.changeset/fuzzy-squids-raise.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+
added mapping for additional EPERM errors

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

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,26 @@ const testErrorMappings = [
362362
expectedDownstreamErrorMessage: `EACCES: permission denied, unlink '.amplify/artifacts/cdk.out/synth.lock'`,
363363
},
364364
{
365-
errorMessage: `EPERM: operation not permitted, rename 'C:/Users/someUser/amplify/artifacts/cdk.out/synth.lock.6785_1' → 'C:/Users/someUser/amplify/artifacts/cdk.out/synth.lock'`,
366-
expectedTopLevelErrorMessage: `Not permitted to rename file: 'C:/Users/someUser/amplify/artifacts/cdk.out/synth.lock.6785_1'`,
365+
errorMessage: `[31mEPERM: operation not permitted, rename 'C:/Users/someUser/.amplify/artifacts/cdk.out/synth.lock.6785_1' → 'C:/Users/someUser/amplify/artifacts/cdk.out/synth.lock' [31m`,
366+
expectedTopLevelErrorMessage: `Not permitted to rename file: 'C:/Users/someUser/.amplify/artifacts/cdk.out/synth.lock.6785_1'`,
367+
errorName: 'FilePermissionsError',
368+
expectedDownstreamErrorMessage: undefined,
369+
},
370+
{
371+
errorMessage: `[31mEPERM: operation not permitted, unlink '.amplify/artifacts/cdk.out/read.4276_1.lock' [31m`,
372+
expectedTopLevelErrorMessage: `Operation not permitted on file: '.amplify/artifacts/cdk.out/read.4276_1.lock'`,
373+
errorName: 'FilePermissionsError',
374+
expectedDownstreamErrorMessage: undefined,
375+
},
376+
{
377+
errorMessage: `[31mEPERM: operation not permitted, open '.amplify/artifacts/cdk.out/synth.lock.6785_1' [31m`,
378+
expectedTopLevelErrorMessage: `Operation not permitted on file: '.amplify/artifacts/cdk.out/synth.lock.6785_1'`,
379+
errorName: 'FilePermissionsError',
380+
expectedDownstreamErrorMessage: undefined,
381+
},
382+
{
383+
errorMessage: `Could not create output directory .amplify/artifacts/cdk.out (EPERM: operation not permitted, mkdir '.amplify/artifacts/cdk.out')`,
384+
expectedTopLevelErrorMessage: `Not permitted to create the directory '.amplify/artifacts/cdk.out'`,
367385
errorName: 'FilePermissionsError',
368386
expectedDownstreamErrorMessage: undefined,
369387
},

packages/backend-deployer/src/cdk_error_mapper.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,22 @@ export class CdkErrorMapper {
200200
errorName: 'FilePermissionsError',
201201
classification: 'ERROR',
202202
},
203+
{
204+
errorRegex:
205+
/EPERM: operation not permitted, mkdir '(.*).amplify\/artifacts\/cdk.out'/,
206+
humanReadableErrorMessage: `Not permitted to create the directory '.amplify/artifacts/cdk.out'`,
207+
resolutionMessage: `Check the permissions of '.amplify' folder and try running the command again`,
208+
errorName: 'FilePermissionsError',
209+
classification: 'ERROR',
210+
},
211+
{
212+
errorRegex:
213+
/EPERM: operation not permitted, (unlink|open) (?<fileName>(.*)\.lock\S+)/,
214+
humanReadableErrorMessage: 'Operation not permitted on file: {fileName}',
215+
resolutionMessage: `Check the permissions of '.amplify' folder and try running the command again`,
216+
errorName: 'FilePermissionsError',
217+
classification: 'ERROR',
218+
},
203219
{
204220
errorRegex: new RegExp(
205221
`\\[ERR_MODULE_NOT_FOUND\\]:(.*)${this.multiLineEolRegex}|Error: Cannot find module (.*)`

0 commit comments

Comments
 (0)