Reputation: 1706
I have written a python lambda to redirect unauthorized users to Cognito. The lambda works when I run a test event in the lambda console, but when I try to hit the CloudFront distribution, I get the following error:
[ERROR] Runtime.ImportModuleError: Unable to import module 'app': No module named
'pyjwt'
Traceback (most recent call last):
I am not referring to pyjwt in my code. I am doing this import jwt
, and I my lambda uses these packages. I have tried deleting the lambda@edge association and the lambda.
I'm completely stuck at this point. What can I try next?
Upvotes: 0
Views: 197
Reputation: 1706
The problems seems to be that all my packages needed to be in a lib
folder for lambda@edge to find them. I found this answer on StackOverflow a little while ago, but I closed it and can't seem to find it again. The directory structure needs to be something like:
main_folder
--lib
----lib1
----lib2
----lib3
function_handler.py
Upvotes: 0