simple-serverless-fastapi-example
simple-serverless-fastapi-example copied to clipboard
when i am deploying it to lambda i am getting an errr i.e fastapi module not found
which are files need to be there in functions.zip?
@singhbhupinder651 It sounds like you prob don't have all the Python dependencies in the root of your .zip file.
When you're running it on your local machine Python will usually look for them in
my_project_root/.env/lib/site-packages/fastapi
however Lambda will look for them in the root of your .zip file like
my_project_root/fastapi
try this:
cd venv/lib/python3.9/site-packages || exit
zip -r9 ../../../../function.zip .
cd ../../../../
zip -r9 function.zip app