Deploy EventBridge rule with function

I’m trying to use serverless to deploy an AWS lambda function and EventBridge rule,
following the documentation here.

The function deploys, but does not create an event rule. Is this a problem with my syntax, with serverless, or the documentation?

I can define and deploy similar rules via cloudformation, but would prefer to use the pattern described in the docs because it seems cleaner when you have many rules that each call only one function.

functions:
  event-user-registeredSuccessfully:
    handler: src/handlers/userRegisteredSuccessfully
    events:
      - eventBridge:
        pattern:
          detail-type:
            - user.registeredSuccessfully
          source:
            - accounts-api

Any ideas or suggestions?

I went back to the docs and noticed everything after eventBridge needed an extra indent, otherwise there are no warnings/errors, but the rule is not created.

- eventBridge:
  pattern: # silent error
    pattern: # works
3 Likes

Wow. That was random and arbitrary. Thanks for putting this here <3