I have a Python function I'm individually packaging with requirements with a config like
plugins:
- serverless-python-requirements
package:
individually: true
functions:
hello:
handler: handler.lambda_handler
module: func1
With a file structure like
serverless.yml
func1/
__init__.py
handler.py
requirements.txt
I can deploy this function and it works fine, but when I try to invoke it locally, it fails. It looks like it doesn't do anything with the module, and just tries to run handler.lambda_handler instead of ./func1.handler.lambda_handler. If I change handler to func1.handler.lambda_handler, it runs locally, but obviously would fail when deployed.
Is there something I'm missing to make this work, or is this something that's possible to do with this plugin?
good catch. @cgrimal, i think we could fix this by tapping in to the invoke local event and modifying functions.FUNCNAME.handler by prepending functions.FUNCNAME.module if it's set. Does that sound reasonable?
For anyone else who arrives here from Google - Note that there are at least a couple of hacky workarounds to this issue: https://github.com/UnitedIncome/serverless-python-requirements/issues/520#issuecomment-648001384
Most helpful comment
good catch. @cgrimal, i think we could fix this by tapping in to the invoke local event and modifying
functions.FUNCNAME.handlerby prependingfunctions.FUNCNAME.moduleif it's set. Does that sound reasonable?