Skip to content

RE: feat(apigatewayv2-integrations): add PutEvents support for EventBridge integration #36775

Closed

Description

@jayfry1077

No, you are right, we should just keep the default ones in there. Updated the code and added comments to keep future readers informed about the required params

Originally posted by @jasdeepbhalla in #35766 (comment)

This doesn't make sense to me that we have to provide the EventBusRef AND a parameter mapping for the eventBusName.

I can't think of any scenario where we would want them to be different.

Example

    this.httpApi.addRoutes({
      path: '/webhook/some/web/hook',
      methods: [httpapi.HttpMethod.POST],
      authorizer: this.customAuthorizer.httpAuthorizer,
      integration: new HttpEventBridgeIntegration('WebhookInt', {
        eventBusRef: props.eventBus.eventBusRef,
        parameterMapping: new httpapi.ParameterMapping()
          .custom('EventBusName', props.eventBus.eventBusName),
      },
      ),
    });

why not just let me create it as this

    this.httpApi.addRoutes({
      path: '/webhook/some/web/hook',
      methods: [httpapi.HttpMethod.POST],
      authorizer: this.customAuthorizer.httpAuthorizer,
      integration: new HttpEventBridgeIntegration('WebhookInt', {
        eventBusRef: props.eventBus.eventBusRef
      ),
    });

and the CDK adds the EventBusName for me which would be part of the eventBus object already

Activity

  1. pahud commented on Jan 22, 2026

    @pahud
    Contributor

    Current vs Expected

    > ┌─────────────────────────────────────────────────────────────────────────────┐
    │                            CURRENT BEHAVIOR                                 │
    └─────────────────────────────────────────────────────────────────────────────┘
    
      User Code:
      ┌────────────────────────────────────────────────────────────────────────┐
      │  new HttpEventBridgeIntegration('WebhookInt', {                        │
      │    eventBusRef: props.eventBus.eventBusRef,  ◄─────┐                   │
      │    parameterMapping: new ParameterMapping()        │  REDUNDANT!      │
      │      .custom('EventBusName', props.eventBus.eventBusName), ◄───┘       │
      │  })                                                                    │
      └────────────────────────────────────────────────────────────────────────┘
                                        │
                                        ▼
      ┌─────────────────────────────────────────────────────────────────────────┐
      │  eventBusRef = {                                                        │
      │    eventBusArn: "arn:aws:events:us-east-1:123456:event-bus/MyBus"       │
      │    eventBusName: "MyBus"  ◄──── Already has the name!                   │
      │  }                                                                      │
      └─────────────────────────────────────────────────────────────────────────┘
                                        │
                                        ▼
      ┌─────────────────────────────────────────────────────────────────────────┐
      │  createDefaultParameterMapping() returns:                               │
      │  ┌───────────────────────────────────────────────────────────────────┐  │
      │  │  Detail      → $request.body.Detail                               │  │
      │  │  DetailType  → $request.body.DetailType                           │  │
      │  │  Source      → $request.body.Source                               │  │
      │  │  EventBusName → ❌ NOT INCLUDED (user must add manually)          │  │
      │  └───────────────────────────────────────────────────────────────────┘  │
      └─────────────────────────────────────────────────────────────────────────┘
    
    
    ┌─────────────────────────────────────────────────────────────────────────────┐
    │                            EXPECTED BEHAVIOR                                │
    └─────────────────────────────────────────────────────────────────────────────┘
    
      User Code:
      ┌────────────────────────────────────────────────────────────────────────┐
      │  new HttpEventBridgeIntegration('WebhookInt', {                        │
      │    eventBusRef: props.eventBus.eventBusRef,  ◄─── Just this!           │
      │  })                                                                    │
      └────────────────────────────────────────────────────────────────────────┘
                                        │
                                        ▼
      ┌─────────────────────────────────────────────────────────────────────────┐
      │  CDK auto-extracts eventBusName from eventBusRef                        │
      └─────────────────────────────────────────────────────────────────────────┘
                                        │
                                        ▼
      ┌─────────────────────────────────────────────────────────────────────────┐
      │  createDefaultParameterMapping() should return:                         │
      │  ┌───────────────────────────────────────────────────────────────────┐  │
      │  │  Detail       → $request.body.Detail                              │  │
      │  │  DetailType   → $request.body.DetailType                          │  │
      │  │  Source       → $request.body.Source                              │  │
      │  │  EventBusName → ✅ AUTO from eventBusRef.eventBusName             │  │
      │  └───────────────────────────────────────────────────────────────────┘  │
      └─────────────────────────────────────────────────────────────────────────┘
    
    
    ┌─────────────────────────────────────────────────────────────────────────────┐
    │                               THE FIX                                       │
    └─────────────────────────────────────────────────────────────────────────────┘
    
      In eventbridge.ts, line ~89:
    
      BEFORE:                                 AFTER:
      ┌─────────────────────────────────┐     ┌─────────────────────────────────┐
      │ return new ParameterMapping()   │     │ return new ParameterMapping()   │
      │   .custom('Detail', ...)        │     │   .custom('Detail', ...)        │
      │   .custom('DetailType', ...)    │     │   .custom('DetailType', ...)    │
      │   .custom('Source', ...);       │     │   .custom('Source', ...)        │
      │                                 │     │   .custom('EventBusName',       │
      │   // EventBusName missing! ❌   │     │     this.props.eventBusRef      │
      │                                 │     │       .eventBusName); ✅        │
      └─────────────────────────────────┘     └─────────────────────────────────┘
    

    Hi @jayfry1077,

    Thank you for raising this issue. Your feedback is valid - it appears the current implementation requires redundant configuration where users must specify EventBusName in the parameter mapping even though eventBusRef already contains this information.

    Looking at the HttpEventBridgeIntegration implementation, the createDefaultParameterMapping method intentionally omits EventBusName as an "optional" parameter. However, since eventBusRef is required and contains eventBusName, it would improve the developer experience to auto-populate this value in the default mapping.

    This is a valid feature request. If you're interested in contributing, a PR that modifies createDefaultParameterMapping to include .custom('EventBusName', this.props.eventBusRef.eventBusName) would be welcome! That said, if I've overlooked
    something, please let me know.

  2. added
    feature-requestA feature should be added or improved.
    effort/smallSmall work item – less than a day of effort
    on Jan 22, 2026
  3. github-actions commented on Apr 29, 2026

    @github-actions
    Contributor

    Comments on closed issues and PRs are hard for our team to see.
    If you need help, please open a new issue that references this one.

  4. locked as resolved and limited conversation to collaborators on Apr 29, 2026
  5. added a commit that references this issue on Apr 30, 2026
    9734bb4
  6. added a commit that references this issue on Jul 29, 2026
    69e5a4f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions