fix(eventbridge): stop schedule-only rules from matching put events (#5168)

A rule with a ScheduleExpression and no EventPattern was matched by every
PutEvents call on its bus, because matchesPattern treats a missing pattern
as match-all. In AWS such a rule only fires on its schedule. Skip rules
without an event pattern when routing put events; archives keep the
match-all semantics they rely on.
This commit is contained in:
Abhigya authored and GitHub committed 2026-10-06 07:18:57 -04:00
1 parent 957d49255a
commit bb24ee09d1
2 files changed
+30

No files matched your search

@@ -812,6 +812,10 @@ public class EventBridgeService implements ResourceProvider {
if (rule.getState() != RuleState.ENABLED) {
continue;
}
// A rule without an event pattern is a schedule rule: it never matches put events.
if (rule.getEventPattern() == null || rule.getEventPattern().isBlank()) {
continue;
}
if (matchesPattern(entry, rule.getEventPattern())) {
String ruleKey = ruleKey(region, effectiveBus, rule.getName());
List<Target> targets = accountGet(targetStore, accountId, ruleKey).orElse(List.of());