By using AWS re:Post, you agree to the Terms of Use

Deploy Lambda Function and API Gateway REST

0

I deployed an API Gateway REST API and a Lambda function using Terraform. REST API testing tool threw below error when I invoked the HTTP endpoint. lambda add-permission was applied. "message": "Internal server error". And CloudWatch shows this error: [ERROR] Runtime.ImportModuleError: Unable to module 'my-lambda': No module named 'my-lambda'

  • Inside of your my-lambda lambda, are you trying to import a module called my-lambda?

  • my-lambda is just a lambda function name. it only has below imports import json import os

2 Answers
0

my_lambda.py should be the name of the file that has the handler.

profile picture
EXPERT
answered 7 months ago
0

See the above answer from Uri. Your zipped file and the contents should have the name of the handler. We wrote a blogpost about this, in case it helps.

answered 7 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions