Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Lambda Python: 'handler' missing on module

I have a deployment package in the following structure:

my-project.zip
    --- my-project.py
    ------ lambda_handler()

Then I define the handler path in configuration file

my-project.lambda_handler

Get the error:

'handler' missing on module

Can not understand that

like image 886
Hello lad Avatar asked Nov 22 '16 12:11

Hello lad


People also ask

How do I add a handler in Lambda?

This function handler name reflects the function name ( lambda_handler ) and the file where the handler code is stored ( lambda_function.py ). To change the function handler name in the Lambda console, on the Runtime settings pane, choose Edit.


1 Answers

I had this issue and had to make sure I had a function called handler in my file, e.g.:

# this just takes whatever is sent to the api gateway and sends it back

def handler(event, context):
    try:
        return response(event, 200)
    except Exception as e:
        return response('Error' + e.message, 400)

def response(message, status_code):
    return message
like image 162
jsims281 Avatar answered Sep 20 '22 07:09

jsims281