我试图在输入中使用ResultPath来存储lambda函数的输出,这样我就可以在step函数的其他状态中使用它作为输入,但是step函数在添加ResultPath后几秒钟内被取消
Lambda函数:
def lambda_handler(event, context):
# TODO implement
import boto3
s3 = boto3.client('s3')
data = s3.get_object(Bucket='test1', Key='Testing-sandbox/Test_sql_script.sql')
contents = data['Body'].read()
print(contents)
return contents
Lambda函数输出:
Response
"/* Step - 1 */ \r\nSELECT * FROM test1 LIMIT 10;\r\n/* Step - 2 */ \r\nSELECT * FROM test2 limit 10;\r\n"
步骤功能:
{
"StartAt": "CallFunction",
"States": {
"CallFunction": {
"Type": "Task",
"Resource": "arn:aws:lambda:us-west-2:12345678:function:readFile",
"ResultPath": "$.query",
"End": true
}
}
}
我对AWS比较陌生,无法调试该问题。有人能解释一下/告诉我正确的文档吗
非常感谢您提供的任何帮助/链接
我发现了问题。这是由于数据类型不匹配造成的。返回对象“contents”不是json格式,因此当step函数尝试将其输出存储在ResultPath中时失败。 以下代码适用于我:
相关问题 更多 >
编程相关推荐