Error on deploy: "Missing or invalid 'path' property in function"

Hi, I’m trying, and failing, to say hello to the world. This is the only function I have in serverless.yml, which my yaml linter says is valid:

functions:
  hello:
    handler: handler.hello
    events:
      - http:
        path: hello
        method: get

There’s a matching handler in handler.js. When I run serverless deploy I get:

Missing or invalid “path” property in function “hello” for http event in serverless.yml. If you define an http event, make sure you pass a valid value for it, either as string syntax, or object syntax. Please check the indentation of your config values if you use the object syntax. Please check the docs for more options.

If I remove the event it deploys fine. I’m running Node 7.2.1 and Serverless 1.18.0 (also tried 1.17.0) on OSX. Am I missing something obvious? It’s kind of embarrassing to get blocked on hello world :-/

I think that handler’s path wrong.
Please check the directory structure of handler.hello once again.

You need to bump the path and method another tabstop.

functions:
  hello:
    handler: handler.hello
    events:
      - http:
          path: hello
          method: get
5 Likes

Ah, didn’t realize yaml indentation changed in that circumstance–works now. Thank you very much for the quick reply, much appreciated!

1 Like

Great Catch. I am too faced the same issue :slight_smile:

Thank you very much.