Python 处理程序错误 - 没有足够的值来解包
Python handler error - not enough values to unpack
我有以下 python 功能:
def evaluate_conditions(context, event):
sqs_count = sqs_msg_count()
sqs_average = int(os.environ["AVG_QUEUE_SIZE"])
ec2_count = running_instance_count()
ec2_average = int(os.environ["AVG_NR_OF_EC2_SCAN_SERVERS"])
print(f"Number of EC2 instances is {ec2_count}")
print(f"Queue size is {sqs_count}")
if sqs_count > sqs_average and ec2_count > ec2_average:
print("False alert, queue is above the average queue size, but enough ec2 instances are running")
logger.info()
elif sqs_count < sqs_average and ec2_count < ec2_average:
print("False alert, queue is below the average queue size")
# logger.info()
elif sqs_count < sqs_average and ec2_count > ec2_average:
print("False alert, queue is below the queue average, and there are enough ec2 instances running")
logger.info()
else:
sns_client.publish(
TopicArn=os.environ["SNS_ARN"],
Message="Sample",
Subject="Monitoring",
)
print("Published to SNS Topic")
在我使用无服务器重新部署 aws lambda 中的函数后,我现在收到以下错误
{
"errorMessage": "Bad handler 'function.name/evaluate_conditions': not enough values to unpack (expected 2, got 1)",
"errorType": "Runtime.MalformedHandlerName",
"stackTrace": []
}
但在重新部署后,完全相同的功能可以正常工作。
aws lambda 中定义的处理程序是“function.name/evaluate_conditions”
我该如何解决这个问题?
发现错误,正确的处理程序名称是“function.name/handler.evaluate_conditions
我有以下 python 功能:
def evaluate_conditions(context, event):
sqs_count = sqs_msg_count()
sqs_average = int(os.environ["AVG_QUEUE_SIZE"])
ec2_count = running_instance_count()
ec2_average = int(os.environ["AVG_NR_OF_EC2_SCAN_SERVERS"])
print(f"Number of EC2 instances is {ec2_count}")
print(f"Queue size is {sqs_count}")
if sqs_count > sqs_average and ec2_count > ec2_average:
print("False alert, queue is above the average queue size, but enough ec2 instances are running")
logger.info()
elif sqs_count < sqs_average and ec2_count < ec2_average:
print("False alert, queue is below the average queue size")
# logger.info()
elif sqs_count < sqs_average and ec2_count > ec2_average:
print("False alert, queue is below the queue average, and there are enough ec2 instances running")
logger.info()
else:
sns_client.publish(
TopicArn=os.environ["SNS_ARN"],
Message="Sample",
Subject="Monitoring",
)
print("Published to SNS Topic")
在我使用无服务器重新部署 aws lambda 中的函数后,我现在收到以下错误
{
"errorMessage": "Bad handler 'function.name/evaluate_conditions': not enough values to unpack (expected 2, got 1)",
"errorType": "Runtime.MalformedHandlerName",
"stackTrace": []
}
但在重新部署后,完全相同的功能可以正常工作。 aws lambda 中定义的处理程序是“function.name/evaluate_conditions”
我该如何解决这个问题?
发现错误,正确的处理程序名称是“function.name/handler.evaluate_conditions