Missing "handler" property in function
Error Message
Missing “handler” property in function “events”. Please make sure you point to the correct lambda handler. For example: handler.hello. Please check the docs for more info
Problem
Each Lambda function needs to have a handler
property pointing to the location of the handler function. In this case, Serverless Framework is not able to parse the handler property.
Solution
Ensure that the handler
attribute is defined in the serverless.yml
for the given function. If it is, then double-check the formatting of your serverless.yml
.
Below are a couple of examples of poorly indented serverless.yml
sections.
Example 1: The following would result in a Missing "handler" property in function "hello".
error. Note how the handler:
property is indented.
...
functions:
hello:
handler: hello.main
...
Example 2: The following would result in a Missing "handler" property in function "events".
error. Note how the events:
block is indented.
...
functions:
hello:
handler: hello.main
events:
- http:
...
Example 3: The resources block is poorly indented as a function. And the resulting error would be: Missing "handler" property in function "resources".
.
...
functions:
hello:
handler: hello.main
resources:
Outputs:
UsersTableArn:
...
Note that a correctly formatted handler block has all its properties indented to the right of the function name.
...
functions:
hello:
handler: hello.main
events:
- http:
...
Help improve this page. Edit it with GitHub
Was this page helpful? Let us know via Twitter
Do your Serverless deployments take too long? Incremental deploys in Seed can speed it up 100x!
Learn More