Unable to import module lambda function No module named lambda function

+1 vote

Hi Guys,

I created one lambda function using python. But I am getting this below error at the time of running.

Unable to import module 'lambda_function': No module named lambda_function

How can I solve this error?

Apr 28, 2020 in AWS by akhtar
• 38,260 points
50,593 views

1 answer to this question.

+1 vote
Best answer

Hi@akhtar,

This error appears when you haven’t named your code file or function correctly. You need to go to Lambda -> Functions -> Your Function -> Configuration and check the value in the Handler field.

The format should be fileName.handlerMethod.

Hope this will solve your error.

answered Apr 28, 2020 by MD
• 95,460 points

selected Dec 15, 2020 by akhtar
I would like to share a very basic mistake which will also cause this issue. While compress (Zip) the Lambda_function before upload, please execute compression (zip) where all required PY and import modules are located. Do not compress the parent folder where entire files are stored.

When we open the <file.zip>, it should display the scripts and modules and not the parent folder.
can't see handler field under configuration

Related Questions In AWS

+1 vote
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
+1 vote
1 answer

'No module named 'requests'' on the AWS Python Lambda function?

Hi@akhtar, For a detailed, You can even check ...READ MORE

answered Apr 15, 2020 in AWS by MD
• 95,460 points
17,251 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP