Skip to content

Commit ec1098d

Browse files
committed
Update getRules function to handle missing load balancers gracefully
1 parent aa60a5e commit ec1098d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/updateListenerRules.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,13 @@ async function getRules(resources: EnvironmentResourceDescription[]) {
251251
}
252252
}
253253

254+
const rules = new Map<string, Rule>();
255+
254256
if (loadBalancerArns.size === 0) {
255-
throw new Error("No load balancers found");
257+
console.warn("No load balancers found");
258+
return rules;
256259
}
260+
257261
if (loadBalancerArns.size > 1) {
258262
throw new Error("Environments must use the same load balancer");
259263
}
@@ -264,7 +268,7 @@ async function getRules(resources: EnvironmentResourceDescription[]) {
264268
})
265269
);
266270

267-
const rules = new Map<string, Rule>();
271+
268272
for (const { ListenerArn } of Listeners) {
269273
await elbv2Client
270274
.send(new DescribeRulesCommand({ ListenerArn }))

0 commit comments

Comments
 (0)