Skip to content

Feedback for “EventBridge event bus” -> handler can not be found #1716

@Eviltoastey

Description

@Eviltoastey

the documentation states implementing this will create a lambda called events and create an eventRule too:

functions:
    # ...
    events:
        handler: App\MyHandler
        events:
            - eventBridge:
                pattern:
                    detail-type:
                        - 'MyCustomEvent'

However when I add my handlers (I gave 2 examples) I walk into two issues:

  • The lambdas it makes are node 14 while (i think) it should be linux 2. I found a fix for this. You can add: runtime: php-82-fpm or any other php version to make the lambda run the correct env.
  • The handlers I've made can not be found. I tried various ways of writing the path to the handler but it wont work.

My example code:

functions:
    vacancy-applied-send-to-dynamics:
        handler: App\EventBridgeHandlers\SendVacancyToDynamicsHandler\SendVacancyToDynamicsHandler
        runtime: php-82-fpm
        events:
          - eventBridge:
              pattern:
                  detail-type:
                      - 'VancancyApplied'

    vacancy-import-cluen-scheduled:
      handler: App/EventBridgeHandlers/ImportVacanciesFromCluen/ImportVacanciesFromCluenHandler
      runtime: php-82-fpm
      events:
        - eventBridge:
            name: vacancy-import-cluen-scheduled
            description: Imports vacancies from external service every 60 minutes
            schedule: rate(60 minutes)

What am I doing wrong here? Serverless creates the correct eventRule and couples the lambda correctly. I can see in cloudwatch that the lambda actually gets fired but the result is always the same: Handler can not be found.

I hope someone can help me out! Thanks in advance :)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions