【发布时间】:2018-05-30 02:50:35
【问题描述】:
我一直在尝试从 Amazon Connect 调用 Python 中的简单 lambda 函数,但无法这样做。
错误:The Lambda Function Returned An Error.
功能:
import os
def lambda_handler(event, context):
what_to_print = 'hello'
how_many_times =1
# make sure what_to_print and how_many_times values exist
if what_to_print and how_many_times > 0:
for i in range(0, how_many_times):
# formatted string literals are new in Python 3.6
print(f"what_to_print: {what_to_print}.")
return what_to_print
return None`
现在,每当我尝试使用 CLI aws lambda invoke --function-name get_info outputfile.txt 调用此函数时,它都会成功运行并产生正确的输出。
现在奇怪的部分来自 Amazon Connect 我能够轻松调用任何 node.js lambda 函数,只有 Python 函数会产生错误。
【问题讨论】:
标签: python-3.x amazon-web-services aws-lambda amazon-connect