Skip to content

feat(aws-node-eventbridge-rule): add an EventBridge rule example with a content filter and a live test - #845

Merged
czubocha merged 2 commits into
v4from
branch/dreamy-lamport-709whe-eventbridge-rule
Nov 26, 2026
Merged

czubocha merged 2 commits into
v4from
branch/dreamy-lamport-709whe-eventbridge-rule

Conversation

@czubocha

Copy link
Copy Markdown
Contributor

Adds aws-node-eventbridge-rule: a Lambda function triggered by an Amazon EventBridge rule on the default event bus, with a content filter.

Lesson: the eventBridge event with a pattern creates a rule on the default bus, and EventBridge invokes the function only for matching events (source: orders.app, detail-type: OrderPlaced, detail.total >= 100). An order of 250 reaches the function; an order of 40 doesn't.

Left out on purpose: a producer function or API (Try it publishes with aws events put-events), custom buses (covered by compose-eventbridge-custom-bus), schedules, input transformation, retry policy and dead-letter queue, AWS service event patterns (mentioned in How it works). No npm dependencies: the handler only logs.

Files: serverless.yml, handler.mjs (ESM, nodejs24.x, arm64), example.json with a script check, test/smoke.mjs, README in the standard sections; npm run docs regenerated examples.json and the root README tables.

Evidence

Serverless Framework 4.47.0, 2026-11-25.

  • Static: node scripts/check-examples.mjs aws-node-eventbridge-rule 0 errors, --package 0 errors, npm run validate 0 errors (24 examples, on the current v4), npm test 323 passed, npm run check-docs clean.
  • Hand run of the README (us-east-1): deploy, put-events with totals 250 and 40, serverless logs showed only Order o-1001 placed: total 250, …; removed.
  • Live test (scripts/test-example.mjs):
    PASS aws-node-eventbridge-rule 4.47.0 200s   # us-east-1
    PASS aws-node-eventbridge-rule 4.47.0 203s   # eu-west-1
    [check] put-events -> function logged "Order o-6e1054bc-1 placed: total 250"; order o-6e1054bc-2 with a total of 40 was filtered out
    
  • Negative control: a scratch copy with the pattern changed to >= 10 stopped at the check step: order o-21fcb3da-2 with a total of 40 reached the function.
  • Leftovers: no stack, log group or rule for any of the test stages in us-east-1 or eu-west-1.
  • Fresh-agent test (an agent given only the example folder): deployed, saw the 250 order only, removed, confirmed the stack gone; no README step needed a guess. It noted that the cleanup line omitted the IAM role, now fixed.
  • npm audit: 0 vulnerabilities.

Generated by Claude Code

@czubocha
czubocha merged commit 1ae4218 into v4 Nov 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant