Skip to content

Commit

Permalink
fix(AWS Deploy): Correctly identify "no updates" error during deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
pgrzesik committed Apr 6, 2021
1 parent dae9058 commit 0e6a1ce
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
20 changes: 11 additions & 9 deletions lib/plugins/aws/lib/updateStack.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,17 @@ module.exports = {
params.RollbackConfiguration = this.serverless.service.provider.rollbackConfiguration;
}

return this.provider
.request('CloudFormation', 'updateStack', params)
.then((cfData) => this.monitorStack('update', cfData))
.catch((e) => {
if (e.message === NO_UPDATE_MESSAGE) {
return BbPromise.resolve();
}
throw e;
});
let cfData;
try {
cfData = await this.provider.request('CloudFormation', 'updateStack', params);
} catch (e) {
if (e.message.includes(NO_UPDATE_MESSAGE)) {
return;
}
throw e;
}

await this.monitorStack('update', cfData);
},

async updateStack() {
Expand Down
6 changes: 4 additions & 2 deletions test/unit/lib/plugins/aws/lib/updateStack.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,10 @@ describe('updateStack', () => {
});

it('should success if no changes to stack happened', () => {
awsDeploy.monitorStack.restore();
sinon.stub(awsDeploy, 'monitorStack').rejects(new Error('No updates are to be performed.'));
awsDeploy.provider.request.restore();
sinon
.stub(awsDeploy.provider, 'request')
.rejects(new Error('No updates are to be performed.'));

return awsDeploy.update();
});
Expand Down

0 comments on commit 0e6a1ce

Please sign in to comment.