I'm trying to execute a Lambda function but I get the following error:
{
"errorMessage": "Bad handler 'AlertMetricSender': not enough values to unpack (expected 2, got 1)",
"errorType": "Runtime.MalformedHandlerName",
"stackTrace": []
}
My Lambda handler is specified in AlertMetricSender.py
:
from modules.ZabbixSender import ZabbixSender
def lambda_handler(event, context):
sender = ZabbixSender("10.10.10.10", 10051)
sender.add("Zabbix server", "lambda.test", 5.65)
sender.send()
CodePudding user response:
This is normally caused by an incorrect value specified for the "Handler" setting for the Lambda function.
It is a reference to the method in your function code that processes events i.e. the entry point.
The value of the handler argument is comprised of the below, separated by a dot:
- The name of the file in which the Lambda handler function is located
- The name of the Python handler function.
Make sure you have not missed the filename.
In this case, it looks like the handler should be set to AlertMetricSender.lambda_handler
.