AWS Lambda 'python2.7' can not find my module handler.
START RequestId: c6f97261-ba61-11e7-aeaf-bfb6aa28f7bb Version: $LATEST
Unable to import module 'handler': No module named handler
END RequestId: c6f97261-ba61-11e7-aeaf-bfb6aa28f7bb
REPORT RequestId: c6f97261-ba61-11e7-aeaf-bfb6aa28f7bb Duration: 0.33 ms Billed Duration: 100 ms Memory Size: 1024 MB Max Memory Used: 19 M
handler.py
def handler(event, context):
return {'status': 'success'}
Folder structure:
Written on Windows 10, Deployed using serverless on Ubuntu VM from shared folder with host system. (virtualbox)
Turns out this is a permission issue.
Running chmod 644 handler.py then redeploying fixed the issue.
In my case this was caused by deploying from a shared folder on my Ubuntu VM (Win10 host).
Shared folders have rwxrwx--- permissions, which is not enough for AWS Lambda.
I needed to copy the folder and run chmod in the copied folder, then deploy from there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With