简体   繁体   中英

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. I have this dummy lambda that pass the data name:

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:

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? Do i have to use the InputPath , ResultPath properties of the states machines?

[Update] This is the State machine definition:

{
  "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
    }
  }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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