Skip to content

Commit

Permalink
fix(vm): add try catch on SSM polling
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrlc03 committed Oct 24, 2023
1 parent 531dcd6 commit 3c81c85
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/backend/src/functions/circuit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,13 @@ const waitForVMCommandExecution = (ssm: SSMClient, vmInstanceId: string, command
printLog(`Invalid command ${commandId} execution`, LogLevel.DEBUG)

const ec2 = await createEC2Client()
await stopEC2Instance(ec2, vmInstanceId)

// if it errors out, let's just log it as a warning so the coordinator is aware
try {
await stopEC2Instance(ec2, vmInstanceId)
} catch (error: any) {
printLog(`Error while stopping VM instance ${vmInstanceId} - Error ${error}`, LogLevel.WARN)
}

if (!error.toString().includes(commandId)) logAndThrowError(COMMON_ERRORS.CM_INVALID_COMMAND_EXECUTION)

Expand Down

0 comments on commit 3c81c85

Please sign in to comment.