How do I refer to module not at the root directory in serverless.yml?

Hi,
I am trying to wire a handler to a module in a sub directory. E.g. I have the following directory structure:

invites
– inviteHandlers.js
– inviteStore.js
serverless.yml

What do I set the handler to for the create function in the inviteHandlers module?

handler: "invites/inviteHandlers.create"
handler: invites.inviteHandlers.create
handler: ???

Thanks

Yes, you can simply point to the subdirectory with invites/inviteHanderls.create

I added a PR for putting this into our docs: https://github.com/serverless/serverless/pull/1919

Hey,

I think the issue I am having is with serverless on windows. It seems when I deploy from windows the lambda function doesn’t get the dependencies bundled up with it. I get errors about not being able to find referenced modules. This doesn’t occur when I do the sls deploy from a mac.

Any ideas why the difference between platforms?

This is what I get on Windows

But I get the expected response on Mac.

Here is the repo I am using: https://github.com/beeleebow/serverlessexample

Thanks for your help
Brad

Yes there is an issue in beta 2 causing sub directories to be somewhat “invisible” when unzipped in AWS when packaged from Windows.
There is a PR to fix this:
https://github.com/serverless/serverless/pull/1863

I reproduced the changes locally a few days ago and it has been working great since

The PR has been merged into master btw, so if you do npm install -g serverless/serverless you’ll get the latest master with that change

Thanks. We ended up using https://github.com/elastic-coders/serverless-webpack which gets us around this problem via the webpack bundling