Skip to content

Commit a0b7382

Browse files
hickeydh-awsDustin Hickey
andauthored
added verify retries (#792)
Co-authored-by: Dustin Hickey <hickeydh@amazon.amazon.com>
1 parent c5faf93 commit a0b7382

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/core/runtime/src/create-stack/verify.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ interface CheckStepInput {
1111
assumeRoleName?: string;
1212
}
1313
const sts = new STS();
14+
15+
function sleep(ms: number) {
16+
return new Promise(resolve => setTimeout(resolve, ms));
17+
}
18+
1419
export const handler = async (input: Partial<CheckStepInput>) => {
1520
console.log(`Verifying stack with parameters ${JSON.stringify(input, null, 2)}`);
1621

@@ -24,7 +29,16 @@ export const handler = async (input: Partial<CheckStepInput>) => {
2429
} else {
2530
cfn = new CloudFormation();
2631
}
27-
const stack = await cfn.describeStack(stackName!);
32+
let stack;
33+
let retries = 0;
34+
do {
35+
stack = await cfn.describeStack(stackName!);
36+
if (!stack) {
37+
console.log(`Could not describe stack, retrying ${retries + 1} of 12 times`);
38+
retries = retries + 1;
39+
await sleep(10000);
40+
}
41+
} while (!stack && retries < 12);
2842
if (!stack) {
2943
return {
3044
status: 'FAILURE',

0 commit comments

Comments
 (0)