Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Amazon EventBridge not compatible with partner event sources #6514
This is a Bug Report
When deploying an AWS Lambda that is triggered by Amazon EventBridge using a partner event source (such as segment.com) a CloudFormation error occurs that the event bus cannot be found. This error appears to be caused by the way the event bus ARN is parsed by Serverless, detailed below.
# ... 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' # ...
The deployment error that is displayed in the console is:
In the current implementation, Serverless parses out the event bus ARN so it only includes the text after the last
eventBusName = EventBus.split('/').pop();
This implementation works for custom event busses formatted as follows:
However, it is not compatible with event busses from partner sources or any ARN containing additional
The above ARN path is converted to
Similar or dependent issues:
referenced this issue
Aug 8, 2019
Thanks @pmuens I tried out the PR locally and when I run a deploy it is now able to find the event bus but it looks like there may still be an issue somewhere down the line.
Error output from Serverless deploy:
Now that the name is updated, it looks like the rule being referenced in the error output doesn't line up with the permission and resource assigned in the EventBridge creation.
It could be that the provider's ID is the correct one to use here, so the nesting resource name doesn't cause cascading issues down the line. If there's any other info that would be useful to you, I'm happy to provide it. Let me know when you'd like me to pull and try again.
Thanks for replying @trevorrecker
I was finally able to setup Segment and connect it to AWS via EventBridge. I figured what the other remaining problem you reported above is. I updated the PR, tested it on my end and it works fine.
Could you test it again and confirm that it's also working on your end? Thanks!