Skip to content

fix: EventBridge targets send correct CloudWatch Event format to Lambda#6

Merged
sgtoj merged 1 commit intomainfrom
fix/eventbridge-target-event-format
Feb 18, 2026
Merged

fix: EventBridge targets send correct CloudWatch Event format to Lambda#6
sgtoj merged 1 commit intomainfrom
fix/eventbridge-target-event-format

Conversation

@sgtoj
Copy link
Contributor

@sgtoj sgtoj commented Feb 18, 2026

Summary

  • Replace input with input_transformer on both okta_sync and security_alerts EventBridge targets so the Lambda receives a proper CloudWatchEvent envelope instead of a raw JSON payload it cannot route
  • The input_transformer preserves native EventBridge fields (source, detail-type, time, region) and injects {"action": "<name>"} in detail, matching the app.ScheduledEvent struct the EventBridgeHandler expects

Problem

Both aws_cloudwatch_event_target resources used input with a custom JSON shape:

{"path": "/scheduled/okta-sync", "httpMethod": "POST", "headers": {}, "body": ""}

The Lambda entrypoint (cmd/lambda/main.go) routes events by deserializing into:

  1. APIGatewayV2HTTPRequest — matches when RequestContext.HTTP.Method != ""
  2. CloudWatchEvent — matches when DetailType != ""

The raw JSON matched neither, so every scheduled invocation failed with "unknown lambda event type".

Affected Resources

  • aws_cloudwatch_event_target.okta_sync
  • aws_cloudwatch_event_target.security_alerts

Closes #5

…oudWatch Event format

Both okta_sync and security_alerts EventBridge targets were sending a raw
JSON payload via `input` that the Lambda UniversalHandler did not recognize,
causing all scheduled invocations to fail with "unknown lambda event type".

Replace `input` with `input_transformer` to preserve the native EventBridge
envelope (source, detail-type, time, region) while injecting the correct
action in the detail field, matching the CloudWatchEvent structure that the
Lambda handler expects.

Closes #5
@sgtoj sgtoj merged commit d245769 into main Feb 18, 2026
2 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.

fix: EventBridge targets send wrong event format to Lambda

1 participant