iopipe / serverless-plugin-iopipe

Automatically wrap your serverless framework functions with IOpipe
https://www.iopipe.com
Apache License 2.0
40 stars 8 forks source link

can't use handlers like this `module.exports = () => {}` #16

Closed yonahforst closed 7 years ago

yonahforst commented 7 years ago

handlers like this:

functions:
  handlerFunc:
    handler: functions/handler

throw this error:

Yonahs-MacBook-Pro-2:manager Yonah$ SLS_DEBUG=* sls deploy
Serverless: serverless-plugin-iopipe: Wrapping your functions with IO|...
Failed to require functions.

  Error --------------------------------------------------

     Error: ENOENT: no such file or directory, open '.../manager/.js'

     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

  Stack Trace --------------------------------------------

Error: Error: ENOENT: no such file or directory, open '.../manager/.js'
  at ServerlessIOpipePlugin.getFuncs (/usr/local/lib/node_modules/serverless-plugin-iopipe/dist/index.js:280:13)
  at /usr/local/lib/node_modules/serverless-plugin-iopipe/dist/index.js:96:13
coreylight commented 7 years ago

Hi @yonahforst! Thanks for the PR. Looking into this, I can't seem to get a function to run with the syntax that you noted here, with or without iopipe. Am I missing something? It seems as if serverless really wants you to specify a file + handler.

yonahforst commented 7 years ago

that's interesting. I didn't get any errors on sls 1.14.0

which version did you test it on?

coreylight commented 7 years ago

@yonahforst I tried on 1.13.0 and 1.15.3. I can keep digging if you've got yours working. Would you mind noting as much about your env as possible? Node version, etc.

yonahforst commented 7 years ago

whoops! you're totally right. I was able to deploy but didnt actually try invoking the lambda function. now that i try, i get Bad handler functions/handler is that what you're getting as well?

coreylight commented 7 years ago

Ok, yeah that's what I was getting pretty much, was using sls invoke local -f foo with similar error message. Probably will close this ticket then (?). Thanks for the feedback!

yonahforst commented 7 years ago

Sure thing!