0
votes

I am using virtualenv and serverless-python-requirements for my Python deployment in AWS Lambda using the serverless framework. But after upload when I am calling the function it is giving “module initialization error: [Errno 22] Invalid argument” error.

I am new to the serverless framework so couldn't find out what I am doing wrong.

Here is my serverless.yml file https://gist.github.com/himadriganguly/f9571c09a3c01c79ebf920034f5e5e55

1
Can you share your serverless.yml file? - maafk
@tkwargs Edited my post and added the serverless.yml file link. Thank you. - Himadri Ganguly
I ran into something similar when trying with python 3.6 runtime. I ended up switching to 2.7 and everything worked fine. Check the docs on using Python 3.6. Also (in case you haven't already), verify you're in a virtualenv running Python 3.6 when deploying. Let us know if that helps! - maafk
Already running Python 3.6.2 under virtualenv. - Himadri Ganguly
Do think that there is any issue with Python 3.6 on AWS Lambda as before using serverless when I am packaging it manually to create a zip file and uploading it to Lambda it is working fine. - Himadri Ganguly

1 Answers

0
votes

Error is fixed now, it is the serverless framework issue.

They have fixed it on 1.21.1 release.

(https://github.com/serverless/serverless/releases/tag/v1.21.1).