Skip to content

Running individually packaged functions locally #223

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Kimahriman opened this issue Aug 2, 2018 · 2 comments
Open

Running individually packaged functions locally #223

Kimahriman opened this issue Aug 2, 2018 · 2 comments
Labels

Comments

@Kimahriman
Copy link

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?

@dschep
Copy link
Contributor

dschep commented Aug 8, 2018

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?

@jamesoflol
Copy link

For anyone else who arrives here from Google - Note that there are at least a couple of hacky workarounds to this issue: #520 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants