# Amazon EventBridge Partner Event Sources Error

**URL:** <https://forum.serverless.com/t/amazon-eventbridge-partner-event-sources-error/9011>\
**Category:** Serverless Framework\
**Tags:** aws, lambda, cloudformation\
**Created:** [August 6, 2019, 7:43pm UTC](https://forum.serverless.com/t/amazon-eventbridge-partner-event-sources-error/9011 "2019-08-06T19:43:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![trevor](https://avatars.discourse-cdn.com/v4/letter/t/258eb7/32.png) [@trevor](https://forum.serverless.com/u/trevor)\
**Post date:** [August 6, 2019, 7:43pm UTC](https://forum.serverless.com/t/amazon-eventbridge-partner-event-sources-error/9011/1 "2019-08-06T19:43:49Z")

</div>

I’m testing out the new [Amazon EventBridge](https://aws.amazon.com/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](https://serverless.com/framework/docs/providers/aws/events/event-bridge/) 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:

```yaml
# ...
functions:
  # ...
  create-request:
    handler: functions/handler.createRequest
    events:
      - eventBridge:
          eventBus: 'arn:aws:events:us-east-1:XXXXXXXXXXXX:event-bus/aws.partner/segment.com/XXXXXXXXXX'
          pattern:
            source:
              - 'aws.partner/segment.com/XXXXXXXXXX'
            detail:
              event:
                - 'My Event'
              type:
                - '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:

```plaintext
CloudFormation - CREATE_FAILED - Custom::EventBridge - CreateDashrequestCustomEventBridge1

```

Followed by a CloudFormation rollback and the following error output:

```plaintext
Serverless: Operation failed!
Serverless: View the full error output: https://us-east-1.console.aws.amazon.com/cloudformation/home?region=us-east-1#/stack/detail?stackId=arn%3Aaws%3Acloudformation%3A[...]
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.

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/serverless/original/2X/c/cddb0ad845ba53cab949340b5e1a0daccab6b335.png)

Any assistance would be greatly appreciated.

---

<div class="post-metadata">

**Author:** ![trevor](https://avatars.discourse-cdn.com/v4/letter/t/258eb7/32.png) [@trevor](https://forum.serverless.com/u/trevor)\
**Post date:** [August 7, 2019, 5:31pm UTC](https://forum.serverless.com/t/amazon-eventbridge-partner-event-sources-error/9011/2 "2019-08-07T17:31:59Z")

</div>

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](https://github.com/serverless/serverless/commit/871b04e238b19bc9c57a9b430685ad157b52b98b#diff-8996f21d004732c3332fe2aeb726f6bbR122)

```javascript
// 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

```nohighlight
event-bus/<bus_name>

```

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

```nohighlight
event-bus/aws.partner/segment.com/XXXXXXXXXX

```

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](https://github.com/serverless/serverless/issues/6514) for this bug
