Events for "hello" must be an array, not an object


#1

I’m following the installation documentation and when I run serverless deply I get an error Events for “hello” must be an array, not an object…

Can someone help me with this issue. I’m new to serverless and I’m trying to create the simple hello function to my aws lambda account. Thanks


#2

The events property for your function definition needs to be a YAML array.

This is probably because the example code is for a different version of Serverless than you’re running.


#3

If you need help debugging your serverless.yml file then it’s best to include the relevant sections in your post. So many of these problems come down to formatting.


#4

You are right. I’m new to yaml as well and didn’t know that indentation was important.


#5

The events property for your function definition needs to be a YAML array.
"- http" use a space between "-"and “http”. This may solve your problem.


#6

Thanks @akhilesh … this worked for me.