By using AWS re:Post, you agree to the Terms of Use
/Is there a way to pass through specific optional input parameters/

Is there a way to pass through specific optional input parameters


Let's say I define a task state that invokes a Lambda. I'm wondering if there's a way I can pass through or default a specific optional input parameter in the Parameters property.

"someState": {
  "Type": "Task",
  "Resource": "arn:aws:states:::lambda:invoke",
  "Parameters": {
    "FunctionName": "someFunction",
    "InvocationType": "RequestResponse",
    "Qualifier.$": "$.environmentId",
    "Payload": {
      "environmentId.$": "$.environmentId",
      "someParameter.$": "$.someParameter",

If someParameter is included in the input I want it to be passed through. Else I'd want one of:

• Omit it.
• Be able to configure a default for it.
• Or if it even defaulted to null automatically, that'd be workable for me.

Is there a way to do that?

What actually happens is an error like:

  "error": "States.Runtime",
  "cause": "An error occurred while executing the state 'someState' (entered at the event id #7). The JSONPath '$.someParameter' specified for the field 'someParameter.$' could not be found in the input"

Consider this scenario: I have application environments staging and production that execute the step function. someFunction has aliases with those names.

I want someFunction to utilize a new request parameter that will be passed in the input to the step function.

The first thing that will happen is the Lambda code deployed to the staging alias will be updated to utilize the new parameter and the application running in the staging environment will pass it to the step function.

At this point the application running in the production environment will not have been updated to pass the new parameter to the step function.

So if I can just optionally pass through the new parameter, all would be well. But in reality it would break the production environment.

So far the best solution I can think of is to change to...

"Payload": "$" pass everything through and pick out the parameters I'm interested in in the Lambda, but it means passing unnecessary data and the state configuration no longer documents the expected parameters.

Edited by: Jesse12345 on Nov 12, 2019 1:26 PM

Edited by: Jesse12345 on Nov 13, 2019 6:22 AM

2 Answers

Hi @Jesse12345

Could you find an answer to the question?

Also, your suggestion of "Payload": "$" might not work.
It will work if you change it to:

"Payload.$": "$"


answered 2 years ago

I am facing the same issue. from my research it seems there is no good way to do this currently.

The only workaround I found was to use a "Choice" task:

See the article here:

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions