简体   繁体   English

aws 步进函数将数据从 lambda 传递到 lambda

[英]aws step functions pass data from lambda to lambda

I've been researching on how to pass data from a Lambda to another Lambda in a Step Function and this is what i got.我一直在研究如何在步骤 Function 中将数据从 Lambda 传递到另一个 Lambda,这就是我得到的。 I have this dummy lambda that pass the data name:我有这个传递数据名称的虚拟 lambda:

exports.lambdaHandler = async (event, context, callback) => {
    const name = 'test';
    callback(null, { name });
}

to another lambda, where i try to get the data in this way, but is not working:到另一个 lambda,我尝试以这种方式获取数据,但无法正常工作:

const name = event.name; //this returns undefined

Based on this tutorial , this should be enough but it doesn't work.根据本教程,这应该足够了,但它不起作用。 Can you point me in what direction should i go?你能指点我 go 的方向吗? Do i have to use the InputPath , ResultPath properties of the states machines?我必须使用状态机的InputPathResultPath属性吗?

[Update] This is the State machine definition: [更新] 这是 State 机器定义:

{
  "Comment": "commen test",
  "StartAt": "FunctionOne",
  "States": {
    "FunctionOne": {
      "Type": "Task",
      "Resource": "arn:aws:states:::lambda:invoke",
      "Parameters": {
        "FunctionName": <arn FunctionOne>
      },
      "Next": "FunctionTwo"
    },
    "FunctionTwo": {
      "Type": "Task",
      "Resource": "arn:aws:states:::lambda:invoke",
      "Parameters": {
        "FunctionName": <arn FunctionTwo>
      },
      "End": true
    }
  }
}

Try this尝试这个

{
  "Comment": "commen test",
  "StartAt": "FunctionOne",
  "States": {
    "FunctionOne": {
      "Type": "Task",
      "Resource": "<arn FunctionOne>",
      "Next": "FunctionTwo"
    },
    "FunctionTwo": {
      "Type": "Task",
      "Resource": "<arn FunctionTwo>",
      "End": true
    }
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM