英文:
StepFunction timing out after invoking from Lambda function
问题
我有一个Lambda函数和一个步骤函数。我试图从我的Lambda函数中调用我的步骤函数。为了做到这一点,我执行了以下操作:(1)为我的Lambda分配了一个'AWSStepFunctionsFullAccess'角色,(2)确保为我的步骤函数传递了正确的输入格式(它唯一的参数是$.Payload
)。
我用来调用我的步骤函数的代码如下:
client = boto3.client('stepfunctions')
transactionId = str(uuid.uuid1());
my_dict =... #这是我想要提供的输入
input = {'Payload': {'input1': "HELLO"}} //理想情况下,我想传递一个字典给我的
response = client.start_execution(
stateMachineArn='arn:aws:states:us-west-2:ACCOUNTNumber:stateMachine:MyStateMachineTest',
name=transactionId,
input= json.dumps(input)
)
出于某种原因,我在日志中不断收到以下错误:2023-02-08T08:05:51.888Z 948af460-9ca2-4d42-aea5-6b26ba007ceb 任务在3.07秒后超时
。
我尝试了很多方法,但仍然无法弄清楚我做错了什么?
英文:
I have a lambda function and a step function. I am trying to invoke my step function from my Lambda function. To do this, I did the following: (1) Provide my Lambda a role of 'AWSStepFunctionsFullAccess', (2) Made sure to pass in the correct input format for my step function (the only parameter it has is a $.Payload
)
My code to invoke my step function looks like:
client = boto3.client('stepfunctions')
transactionId = str(uuid.uuid1());
my_dict =... #This is the input I want to provide
input = {'Payload': {'input1': "HELLO"}} //Ideally I want to pass in a dict to my
response = client.start_execution(
stateMachineArn='arn:aws:states:us-west-2:ACCOUNTNumber:stateMachine:MyStateMachineTest',
name=transactionId,
input= json.dumps(input)
)
For some reason, I keep getting the following error in my logs: 2023-02-08T08:05:51.888Z 948af460-9ca2-4d42-aea5-6b26ba007ceb Task timed out after 3.07 seconds
I tried so many things but still can not figure out what I am doing wrong?
答案1
得分: 1
这种情况发生的原因很可能是因为您为您的Lambda函数(调用状态机的函数)设置了超时。如果您转到Lambda函数 -> 通用配置 -> 编辑 -> 超时(增加此值)
。尝试这样做,应该可以开始工作。
英文:
The reason this is happening is most probably because you have set a timeout to your lambda function (the one invoking the state machine). If you go to your Lambda function -> General Configuration -> Edit -> Timeout (increase this value)
. Try doing that and it should start working.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论