Reputation: 5220
Suppose I have a very simple lambda function
exports.handler = (event,ctx,callback) => {
console.log(event);
callback(null,{iteration:1})
};
That will be used in a AWS Step Function's Step machine with this definition
{
"Comment": "A Hello World example of the Amazon States Language using Pass states",
"StartAt": "Invoke Lambda function",
"States": {
"Invoke Lambda function": {
"Type": "Task",
"Resource": "arn:aws:states:::lambda:invoke",
"Parameters": {
"FunctionName": "arn:aws:lambda:ap-southeast-1:614275xxxxxx:function:sample-state-machine:$LATEST"
},
"Next": "Invoke Lambda function 2"
},
"Invoke Lambda function 2": {
"Type": "Task",
"Resource": "arn:aws:states:::lambda:invoke",
"Parameters": {
"FunctionName": "arn:aws:lambda:ap-southeast-1:614275xxxxxx:function:sample-state-machine:$LATEST"
},
"End": true
}
}
}
However the cloudwatch log show no data inside the event object! Is there something very obvious that I missed?
For clarification:
Testing with the Lambda console test function shows that {iteration:1} is correctly returned as the return value of lambda function
The lambda function in question is based on nodejs.12
Upvotes: 0
Views: 1103
Reputation: 809
Change your state machine to
{
"Comment": "A Hello World example of the Amazon States Language using Pass states",
"StartAt": "Invoke Lambda function",
"States": {
"Invoke Lambda function": {
"Type": "Task",
"Resource": "arn:aws:lambda:ap-southeast-1:614275xxxxxx:function:sample-state-machine",
"Next": "Invoke Lambda function 2"
},
"Invoke Lambda function 2": {
"Type": "Task",
"Resource": "arn:aws:lambda:ap-southeast-1:614275xxxxxx:function:sample-state-machine",
"End": true
}
}
}
According to documentation you need to set the ARN directly as the resource instead of calling lambda resource with arn as a parameter.
Upvotes: 2