0

I am building an application with AWS lambda and the serverless framework. My folder structure looks like this when deployed:

service-dev-lambdaname (name of top level dir)
|__lib
|__serverless.yml
|__python-library-1
|__python-library-2
|__src
    |__lambda

When I run serverless deploy, it correctly packages and uploads my service. It uses the naming convention {service name}-dev-{function name}. This is not the name of the parent folder locally so it is messing up the imports. I thought that instead, I should move everything into src but the serverless plugin packages libraries like python-library-1 and python-library-2 and places them outside src. Is there a way to change the naming convention to fix these import errors?

curiousgeorge
  • 593
  • 1
  • 5
  • 14

1 Answers1

0

You need to use python pip locally within your projects python venv to install your packages. Make sure you have Docker installed, then when you run serverless deploy it will use docker to package up your python libs to be correctly deployed in lambda.

See https://stackoverflow.com/a/50027031/1085343

GWed
  • 15,167
  • 5
  • 62
  • 99