Amazon EventBridge Partner Event Sources Error

I’m testing out the new Amazon EventBridge trigger on a few of my Lambdas and I’m getting errors when I try and add an EventBridge Event Bus source from a partner provider.

My current configuration is based on the Serverless example docs and I’m using Segment as the partner event source. Associations done manually through the AWS console work properly, but I get an error while deploying my changes when creating the eventBridge trigger through Serverless.

Note: I am using Serverless v1.49.0 and deployments work as expected when no Event Bus is specified. This issue is only when associating with a partner event source

Example configuration:

# ...
  # ...
    handler: functions/handler.createRequest
      - eventBridge:
          eventBus: 'arn:aws:events:us-east-1:XXXXXXXXXXXX:event-bus/aws.partner/'
              - 'aws.partner/'
                - 'My Event'
                - 'track'
# ...

In AWS, the event bus is configured and I am able to manually create a lambda with a trigger from Segment events and log them to the console.

When a deploy is run with verbose logging, this is the first error message:

CloudFormation - CREATE_FAILED - Custom::EventBridge - CreateDashrequestCustomEventBridge1

Followed by a CloudFormation rollback and the following error output:

Serverless: Operation failed!
Serverless: View the full error output:[...]
Unhandled rejection ServerlessError: An error occurred: CreateDashrequestCustomEventBridge1 - Failed to create resource. Event bus XXXXXXXXXX does not exist. See details in CloudWatch Log: 2019/08/06/[$LATEST][...].

(I was unable to find the CloudWatch log in the above output, and the CloudFormation page linked only shows the high level error output of UPDATE_ROLLBACK_COMPLETE)

Both the Segment event bus and default bus show in the AWS EventBridge console but I can’t seem to get Serverless to reference the custom event bus properly.

Any assistance would be greatly appreciated.

It looks like this issue is caused by the ARN being parsed by Serverless in a way that makes it incompatible with EventBridge partner sources (or any ARN that contains a / character). The line in question is in this GitHub commit

// lib/plugins/aws/package/compile/events/eventBridge/index.js @ line 122
if (EventBus.startsWith('arn')) {
    eventBusName = EventBus.split('/').pop();

This code works fine for custom event bus ARNs that follow the format


However this won’t work for partner sources like my Segment example


In this case, Serverless is searching for an event bus called only event-bus/XXXXXXXXXX instead of the full bus name.

Edit: I created GitHub issue #6514 for this bug