Skip to content

Commit 18a9b2b

Browse files
committed
fix(AWS Deploy): Fix stack errors processing
1 parent 29f0e9c commit 18a9b2b

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

lib/plugins/aws/lib/monitorStack.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,12 @@ module.exports = {
101101
this.serverless.cli.log(`View the full error output: ${stackUrl}`);
102102
let errorMessage = 'An error occurred: ';
103103
errorMessage += `${stackLatestError.LogicalResourceId} - `;
104-
errorMessage += `${stackLatestError.ResourceStatusReason}.`;
104+
errorMessage += `${
105+
stackLatestError.ResourceStatusReason || stackLatestError.ResourceStatus
106+
}.`;
105107
const errorCode = (() => {
106108
if (
109+
stackLatestError.ResourceStatusReason &&
107110
stackLatestError.ResourceStatusReason.startsWith('Properties validation failed')
108111
) {
109112
return `AWS_STACK_${action.toUpperCase()}_VALIDATION_ERROR`;

test/unit/lib/plugins/aws/lib/monitorStack.test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,6 @@ describe('monitorStack', () => {
921921
ResourceType: 'AWS::CloudFormation::Stack',
922922
Timestamp: new Date(),
923923
ResourceStatus: 'UPDATE_ROLLBACK_IN_PROGRESS',
924-
ResourceStatusReason: 'Export is in use',
925924
},
926925
],
927926
};
@@ -943,7 +942,7 @@ describe('monitorStack', () => {
943942

944943
return awsPlugin.monitorStack('update', cfDataMock, { frequency: 10 }).catch((e) => {
945944
let errorMessage = 'An error occurred: ';
946-
errorMessage += 'mocha - Export is in use.';
945+
errorMessage += 'mocha - UPDATE_ROLLBACK_IN_PROGRESS.';
947946
expect(e.name).to.be.equal('ServerlessError');
948947
expect(e.message).to.be.equal(errorMessage);
949948
// callCount is 2 because Serverless will immediately exits and shows the error

0 commit comments

Comments
 (0)