In serverless i have the following directory structure for my functions:
serverless.yml
functions -
stories -
create.js
get.js
my serverless.yml
then looks like this:
functions:
stories:
create:
handler: functions/stories/create.main
events:
- http:
path: stories/create
method: post
cors: true
authorizer: aws_iam
get:
handler: functions/stories/get.main
events:
- http:
path: stories/{id}
method: get
cors: true
authorizer: aws_iam
however when i run a test to check the create: serverless invoke local --function create --path mocks/create-event.json
i get the following error:
Serverless Error ---------------------------------------
Function "create" doesn't exist in this Service
I managed to get one function working that looks like this:
functions:
stories:
handler: functions/stories/create.main
events:
- http:
path: stories/create
method: post
cors: true
authorizer: aws_iam
Since i added the get function, i decided i needed to add the create and get parts after stories, but no matter how i change the handler the functions never seem to exist.
I've tried changing the path to functions/stories/create/create.main
with no difference, is there anything obvious i'm missing to allow multiple handlers within the same location?
I was looking at the following example, which uses one folder of "todos" which contains multiple functions, but i can't see any obvious difference between it and mine, except i've added an extra folder.
from serverless: function doesn't exist in this service
No comments:
Post a Comment