Title: Feature request: support the new EventBridge Custom Event Bus payloads in data classes and Parser · Issue #8657 · aws-powertools/powertools-lambda-python · GitHub
Open Graph Title: Feature request: support the new EventBridge Custom Event Bus payloads in data classes and Parser · Issue #8657 · aws-powertools/powertools-lambda-python
X Title: Feature request: support the new EventBridge Custom Event Bus payloads in data classes and Parser · Issue #8657 · aws-powertools/powertools-lambda-python
Description: Use case AWS launched a new EventBridge bus, the Custom Event Bus (the one we all know is now "Custom Event Bus - Classic"). It has subscribers instead of rules, retention, FIFO groups, replay, deduplication and PutRawEvents for non-JSON...
Open Graph Description: Use case AWS launched a new EventBridge bus, the Custom Event Bus (the one we all know is now "Custom Event Bus - Classic"). It has subscribers instead of rules, retention, FIFO groups, replay, ded...
X Description: Use case AWS launched a new EventBridge bus, the Custom Event Bus (the one we all know is now "Custom Event Bus - Classic"). It has subscribers instead of rules, retention, FIFO groups, r...
Opengraph URL: https://github.com/aws-powertools/powertools-lambda-python/issues/8657
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Feature request: support the new EventBridge Custom Event Bus payloads in data classes and Parser","articleBody":"### Use case\n\nAWS launched a new EventBridge bus, the **Custom Event Bus** (the one we all know is now \"Custom Event Bus - Classic\"). It has subscribers instead of rules, retention, FIFO groups, replay, deduplication and `PutRawEvents` for non-JSON payloads. API is `aws eventsv2` / boto3 `eventbridgev2` (botocore 1.43.102+).\n\nI deployed a real bus with a Lambda target running our current `EventBridgeEvent` data class and `EventBridgeModel`, and the payloads are different enough that both break in every configuration except the one that imitates Classic:\n\n| Subscriber config | What the function receives | Today |\n|---|---|---|\n| `Transformer: RAW`, default batching, `PutEvents` | a **JSON array** of classic envelopes, even for a single event | `TypeError: list indices must be integers` |\n| `RAW`, `MaxBatchSize: 1`, `PutEvents` | one classic envelope | works |\n| `RAW`, `MaxBatchSize: 1`, `PutRawEvents` | the producer payload alone, no envelope | `KeyError: 'source'` |\n| `Transformer: WITH_METADATA` (single or array) | `{Data, Metadata, SystemMetadata}` | fails |\n| `FIFO` subscriber | array, events of several groups interleaved in order | fails |\n\nThe default for a Lambda target is the array. Anyone following the AWS migration guide will see `@event_source(data_class=EventBridgeEvent)` blow up on the first delivery.\n\nReal payloads captured from the bus:\n\n```json\n// WITH_METADATA, published with PutRawEvents (content type application/json)\n{\n \"Data\": {\"orderId\": \"s3-0\", \"total\": 5},\n \"Metadata\": {\"sub\": \"s3\", \"tenant\": \"acme\"},\n \"SystemMetadata\": {\n \"EventGroupId\": \"43e6837b-3d96-44db-863d-e8abd80cd1e8\",\n \"DeduplicationId\": \"43e6837b-3d96-44db-863d-e8abd80cd1e8\",\n \"ContentType\": \"application/json\",\n \"aws:IngestionTime\": \"2026-10-25T11:48:54.064Z\",\n \"aws:EventId\": \"e3474ffa-0283-4fe7-af27-803e30cd92f4\",\n \"aws:SequenceNumber\": \"10000000000000007000\",\n \"aws:DeliveryType\": \"LIVE\"\n }\n}\n```\n\n```json\n// WITH_METADATA, published with PutEvents: Data holds the classic envelope, SystemMetadata adds aws:Source / aws:DetailType\n[\n {\n \"Data\": {\"version\": \"0\", \"id\": \"1cd1f343-9859-4e28-a539-89352846ce44\", \"detail-type\": \"s6\", \"source\": \"com.example.orders\", \"account\": \"123456789012\", \"time\": \"2026-10-25T11:48:53Z\", \"region\": \"us-east-1\", \"resources\": [], \"detail\": {\"orderId\": \"s6-1\", \"total\": 10}},\n \"Metadata\": {},\n \"SystemMetadata\": {\"EventGroupId\": \"d8c85953-b07f-4bc1-b2ff-044a1c2b03bc\", \"DeduplicationId\": \"d8c85953-b07f-4bc1-b2ff-044a1c2b03bc\", \"ContentType\": \"application/eventbridge+json\", \"aws:IngestionTime\": \"2026-10-25T11:48:53.977Z\", \"aws:Source\": \"com.example.orders\", \"aws:DetailType\": \"s6\", \"aws:EventId\": \"b9c941f6-ccae-473e-95d5-1982a0b1e8a5\", \"aws:SequenceNumber\": \"10000000000000006001\", \"aws:DeliveryType\": \"LIVE\"}\n }\n]\n```\n\nNotes from the test that matter for the design:\n\n- `aws:EventId` is **not** the envelope `id`. The publisher gets `aws:EventId` back from `PutEvents`.\n- `aws:DeliveryType` is `LIVE` or `REPLAY`, which is what a consumer needs to tell replays apart.\n- For `application/octet-stream`, `Data` is a base64 string.\n- Partial batch failure is not usable yet: returning `{\"batchItemFailures\": [...]}` is recorded as `PARTIAL_BATCH_FAILURE` but **every** event in the batch is marked failed, whichever identifier you use (`aws:EventId`, envelope `id`, `aws:SequenceNumber`). An exception retries the whole batch. So Batch integration is out of scope until the service documents an identifier.\n\n### Solution/User Experience\n\nA data class and a Parser model for the new shape, accepting both a single object and an array, and exposing the metadata as attributes.\n\n```python\nfrom aws_lambda_powertools.utilities.data_classes import event_source, EventBridgeV2Event\n\n@event_source(data_class=EventBridgeV2Event)\ndef handler(event: EventBridgeV2Event, context):\n for record in event.records: # always iterable, even when the bus sent one object\n record.data # dict for JSON, bytes for octet-stream\n record.detail # shortcut into data[\"detail\"] when published with PutEvents\n record.metadata # producer keys from PutRawEvents\n record.system_metadata.event_id # aws:EventId\n record.system_metadata.sequence_number\n record.system_metadata.delivery_type # \"LIVE\" | \"REPLAY\"\n record.system_metadata.event_group_id\n record.system_metadata.source, .detail_type, .content_type, .ingestion_time\n```\n\nParser side: `EventBridgeV2Model` (list or single) and an `EventBridgeV2Envelope` that yields the `Data` of each record (or `Data.detail` for `PutEvents` traffic) into the user model, like `EventBridgeEnvelope` does today.\n\n`RAW` deliveries carry no marker, so the class should also accept the classic envelope and the bare `PutEvents` array without complaint, and we document that `WITH_METADATA` is what you want when you need event ids, groups or replay detection.\n\n### Alternative solutions\n\n```markdown\nTell users to set MaxBatchSize=1 and Transformer=RAW so the payload matches Classic. It works, but it throws away batching, ordering metadata and replay detection, which are the reasons to move to the new bus.\n```\n\n### Acknowledgment\n\n- [x] This feature request meets [Powertools for AWS Lambda (Python) Tenets](https://docs.powertools.aws.dev/lambda/python/latest/#tenets)\n- [x] Should this be considered in other Powertools for AWS Lambda languages? i.e. [TypeScript](https://github.com/aws-powertools/powertools-lambda-typescript/), [Java](https://github.com/aws-powertools/powertools-lambda-java/), and [.NET](https://github.com/aws-powertools/powertools-lambda-dotnet/)\n","author":{"url":"https://github.com/leandrodamascena","@type":"Person","name":"leandrodamascena"},"datePublished":"2026-10-25T12:05:38Z","url":"https://github.com/aws-powertools/powertools-lambda-python/issues/8657"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0bfb883d-0308-aa3e-eed1-3b82dcf3788a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 88B0:3AA1C6:29DE97:3A39DB:6B0088F3 |
| html-safe-nonce | 1a9e35c88c4104f8d4fe2bceb9aa919ed9b58a841673d24d92f3e41fff8bb20b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4OEIwOjNBQTFDNjoyOURFOTc6M0EzOURCOjZCMDA4OEYzIiwidmlzaXRvcl9pZCI6IjYyNDk3OTY0NDY4MTY2MDIzNTUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 3c7639bf5603372252ec22901eca70cd60ea370328c7f35983c7b45452bd60eb |
| hovercard-subject-tag | issue:6024247886 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/aws-powertools/powertools-lambda-python/8657/issue_layout |
| twitter:image | https://opengraph.githubassets.com/e8638bc000b87ad641890548018594188254c4b33d388eebeac1cab2fe53b77c/aws-powertools/powertools-lambda-python/issues/8657 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/e8638bc000b87ad641890548018594188254c4b33d388eebeac1cab2fe53b77c/aws-powertools/powertools-lambda-python/issues/8657 |
| og:image:alt | Use case AWS launched a new EventBridge bus, the Custom Event Bus (the one we all know is now "Custom Event Bus - Classic"). It has subscribers instead of rules, retention, FIFO groups, replay, ded... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | leandrodamascena |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4d3d8e50f02c1d7bf86d5acfa1d3bfe9366abd6528a6b429eb07a168429d2b61 |
| turbo-cache-control | no-preview |
| go-import | github.com/aws-powertools/powertools-lambda-python git https://github.com/aws-powertools/powertools-lambda-python.git |
| octolytics-dimension-user_id | 129127638 |
| octolytics-dimension-user_login | aws-powertools |
| octolytics-dimension-repository_id | 221919379 |
| octolytics-dimension-repository_nwo | aws-powertools/powertools-lambda-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 221919379 |
| octolytics-dimension-repository_network_root_nwo | aws-powertools/powertools-lambda-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | db758f8e02b8257935fb03edf81a3e76eb3abd11 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width