Skip to content

Commit

Permalink
Merge pull request #96 from lumigo-io/fix-eventbridge-bug
Browse files Browse the repository at this point in the history
fix: no target ids
  • Loading branch information
efimk-lu authored May 25, 2020
2 parents 5419b2b + 216e5db commit adbf458
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/lib/eventbridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@ const deleteEventBridge = async (eventBridgeName, region, retryOpts, AWS) => {
AWS
);
const targetIDs = targets.map(target => target.targetId);
await EventBridge.removeTargets({
Ids: targetIDs,
Rule: rule.name,
EventBusName: eventBridgeName
}).promise();
if (targetIDs.length > 0) {
await EventBridge.removeTargets({
Ids: targetIDs,
Rule: rule.name,
EventBusName: eventBridgeName
}).promise();
}
await EventBridge.deleteRule({
Name: rule.name,
EventBusName: eventBridgeName
Expand Down

0 comments on commit adbf458

Please sign in to comment.