【问题标题】:How to create event rule for partner event bus in serverless / cloudformation如何在 serverless / cloudformation 中为合作伙伴事件总线创建事件规则
【发布时间】:2021-11-02 16:02:39
【问题描述】:

我正在尝试为合作伙伴事件总线创建一个事件规则,即arn:aws:events:{region}:{accountId}:event-bus/aws.partner/appflow/salesforce.com/{accountId},以将所有事件发送到无服务器中的 SQS 队列,但运气不佳,我一直遇到此错误:

Serverless Error ----------------------------------------
  An error occurred: SFSubscriptionPartnerEventsRule - EventBus name starting with 'aws.' is not valid. (Service: AmazonCloudWatchEvents; Status Code: 400; Error Code: ValidationException; Request ID: ; Proxy: null).

就上下文而言,合作伙伴事件总线名称是在创建 appflow 时自动生成的,因此无法避免名称中的 aws

我可以通过 AWS 控制台(即arn:aws:events:{region}:{accountId}:rule/aws.partner/appflow/salesforce.com/{accountId}/myPartnerEventRule1)创建它,但很难通过无服务器/云形成来创建它。

这里是cloudformation的相关部分:

Type: AWS::Events::Rule
            Properties:
                Description: 'write salesforce subscription event to sqs'
                Name: 'events-${self:custom.deployingStage}-sfsubscriptionevent-sfsubscriptionsqs'
                EventBusName: 
                    Fn::GetAtt:
                        - CustomerPlatformSFPartnerEventBus
                        - Arn
                EventPattern:
                    account:
                        - Ref: 'AWS::AccountId'
                State: ENABLED
                Targets:
                    -   Arn:
                            Fn::GetAtt:
                                - SFSubscriptionToCustomerPlatformQueue
                                - Arn
                        Id: '${self:custom.queue.sfSubscriptionToCustomerPlatformQueue}'
                       

尝试了一些没有用的东西:

  • 将无服务器更新到最新版本 2.51
  • 我想知道您是否将事件规则创建为 appflow 定义 AWS::AppFlow::Flow 的一部分,但在文档中找不到任何内容;也许我是瞎子。
  • 如果我将 EventBusName: 值更改为 Fn::ImportValue: 'DefaultEventBusARN-${self:custom.deployingStage}' 即它部署的非合作伙伴事件总线,则“排除”其他任何内容。但我想要合作伙伴事件总线上的规则。

有什么想法吗?

【问题讨论】:

  • 嘿伙计,你解决了吗?我刚刚在 AWS 中创建了一张关于这个确切问题的票,如果没有,get 会回复你。我正在尝试使用 MongoDB 创建 EventBridge,我可以在控制台中创建所有内容,但不能通过 CloudFormation。
  • @JonathanNielsen 不,我没有,我最终在我们的 CI/CD 管道之外手动创建了资源。如果你有更多的成功,请告诉我?谢谢
  • 我收到了一些反馈,他们将其归类为错误,并会在修复后尽快回复我。同时我在控制台中手动创建它。
  • @JonathanNielsen 哦,太好了,感谢您的更新。您能否提供支持票证 ID,以便我参考?
  • 我也会添加一个带有解决方法的答案

标签: amazon-web-services aws-event-bridge serverless.com


【解决方案1】:

所以这是我偶然发现的 AWS Cloudformation 中的一个错误。 我联系了 AWS Support,得到了一些帮助(案例 ID 9092652141)。

这就是他们关于这个问题的说法

对于此问题可能给您带来的任何不便,我深表歉意,并通知您,我已就此行为与内部团队联系并要求调查此问题。

但是,在他们自己的环境中复制问题后,他们还提供了一个临时解决方法。

不要使用 Arn 或复制粘贴事件总线的名称,而是添加对事件总线名称的引用。我昨天尝试了这个方法,成功创建了事件总线和规则。

话虽如此,至于现在为了创建事件规则,我会要求您传递事件总线的名称而不是 Arn。

Resources:
  EventBus:
    Type: AWS::Events::EventBus
    Properties:
      EventSourceName: <copy-paste the event source name of the partner here>
      Name: <Same as above>

  EventRule:
    Type: AWS::Events::Rule
    Properties:
      Name: <Event rule name>
      EventBusName: !GetAtt EventBus.Name

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-11-24
    • 2019-01-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-07
    • 1970-01-01
    相关资源
    最近更新 更多