From ea0e8ea5ca32e590aa8e5eee96c77e4d00214bf6 Mon Sep 17 00:00:00 2001 From: Etienne Noel Date: Wed, 18 Oct 2023 14:05:47 -0700 Subject: [PATCH] - Should return await to catch the errors. Should also no throw when there are no updates to perform. --- packages/aws/src/clients/cloudformation.client.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/aws/src/clients/cloudformation.client.ts b/packages/aws/src/clients/cloudformation.client.ts index 5e8f23a80..5d87b9d5d 100644 --- a/packages/aws/src/clients/cloudformation.client.ts +++ b/packages/aws/src/clients/cloudformation.client.ts @@ -108,7 +108,7 @@ export class CloudformationClient implements CloudformationClientInterface { this.logHandler.debug("CLOUDFORMATION CLIENT - Creating new stack", {input}, AwsModuleKeyname); const command = new CreateStackCommand(input) try { - return this.getClient().send(command); + return await this.getClient().send(command); } catch (e) { this.logHandler.error("Error creating stack in cloudformation", {error: e}, AwsModuleKeyname); throw e; @@ -123,8 +123,15 @@ export class CloudformationClient implements CloudformationClientInterface { this.logHandler.debug("CLOUDFORMATION CLIENT - Updating stack", {input}, AwsModuleKeyname); const command = new UpdateStackCommand(input) try { - return this.getClient().send(command); + return await this.getClient().send(command); } catch (e) { + if(e.message == "No updates are to be performed.") { + return { + $metadata: { + httpStatusCode: 200, + } + } + } this.logHandler.error("Error updating stack in cloudformation", {error: e}, AwsModuleKeyname); throw e; } @@ -138,7 +145,7 @@ export class CloudformationClient implements CloudformationClientInterface { this.logHandler.debug("CLOUDFORMATION CLIENT - Deleting stack", {input}, AwsModuleKeyname); const command = new DeleteStackCommand(input) try { - return this.getClient().send(command); + return await this.getClient().send(command); } catch (e) { this.logHandler.error("Error deleting stack in cloudformation", {error: e}, AwsModuleKeyname); throw e;