0

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

1 Answer 1

2
+50

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.