Skip to content

Commit ca9d732

Browse files
ShadowCat567Shadowcat567
andauthored
Adds and updates mapping for some validation errors (#2565)
* added and updated validation error mappings * changeset * appeasing lint --------- Co-authored-by: Shadowcat567 <[email protected]>
1 parent dafb530 commit ca9d732

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
lines changed

.changeset/great-swans-collect.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/updated ValidationError mappings

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

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,12 +400,30 @@ const testErrorMappings = [
400400
expectedDownstreamErrorMessage: `error Command cdk not found. Did you mean cdl?`,
401401
},
402402
{
403-
errorMessage: `[31m amplify-some-stack failed: ValidationError: Stack:stack-arn is in UPDATE_ROLLBACK_FAILED state and can not be updated.`,
403+
errorMessage: `[31mamplify-some-stack [34m failed: ValidationError: Stack:<stack-arn> is in UPDATE_ROLLBACK_FAILED state and can not be updated.`,
404404
expectedTopLevelErrorMessage:
405405
'The CloudFormation deployment failed due to amplify-some-stack being in UPDATE_ROLLBACK_FAILED state.',
406406
errorName: 'CloudFormationDeploymentError',
407407
expectedDownstreamErrorMessage: undefined,
408408
},
409+
{
410+
// eslint-disable-next-line spellcheck/spell-checker
411+
errorMessage: `[31mamplifysomestack [34m failed: ValidationError: Stack:<stack-arn> is in UPDATE_ROLLBACK_FAILED state and can not be updated.`,
412+
expectedTopLevelErrorMessage:
413+
// eslint-disable-next-line spellcheck/spell-checker
414+
'The CloudFormation deployment failed due to amplifysomestack being in UPDATE_ROLLBACK_FAILED state.',
415+
errorName: 'CloudFormationDeploymentError',
416+
expectedDownstreamErrorMessage: undefined,
417+
},
418+
{
419+
// eslint-disable-next-line spellcheck/spell-checker
420+
errorMessage: `[1mamplifysomebranch [22m failed: ValidationError: Stack [amplifysomebranch] cannot be deleted while TerminationProtection is enabled`,
421+
expectedTopLevelErrorMessage:
422+
// eslint-disable-next-line spellcheck/spell-checker
423+
'amplifysomebranch cannot be deleted because it has termination deployment enabled.',
424+
errorName: 'CloudFormationDeletionError',
425+
expectedDownstreamErrorMessage: undefined,
426+
},
409427
{
410428
errorMessage: `ENOENT: no such file or directory, open '.amplify/artifacts/cdk.out/manifest.json'`,
411429
expectedTopLevelErrorMessage:

packages/backend-deployer/src/cdk_error_mapper.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,14 +560,24 @@ If your circular dependency issue is not resolved with this workaround, please c
560560
},
561561
{
562562
errorRegex:
563-
/(?<stackName>amplify-[a-z0-9-]+)(.*) failed: ValidationError: Stack:(.*) is in (?<state>.*) state and can not be updated/,
563+
/(?<stackName>amplify[a-z0-9-]+)(.*) failed: ValidationError: Stack:(.*) is in (?<state>.*) state and can not be updated/,
564564
humanReadableErrorMessage:
565565
'The CloudFormation deployment failed due to {stackName} being in {state} state.',
566566
resolutionMessage:
567567
'Find more information in the CloudFormation AWS Console for this stack.',
568568
errorName: 'CloudFormationDeploymentError',
569569
classification: 'ERROR',
570570
},
571+
{
572+
errorRegex:
573+
/failed: ValidationError: Stack \[(?<stackName>amplify[a-z0-9-]+)(.*)\] cannot be deleted while TerminationProtection is enabled/,
574+
humanReadableErrorMessage:
575+
'{stackName} cannot be deleted because it has termination deployment enabled.',
576+
resolutionMessage:
577+
'If you are sure you want to delete {stackName}, you will need to disable TerminationProtection.',
578+
errorName: 'CloudFormationDeletionError',
579+
classification: 'ERROR',
580+
},
571581
{
572582
// Note that the order matters, this should be the last as it captures generic CFN error
573583
errorRegex: new RegExp(

0 commit comments

Comments
 (0)