hi my state machine look like this
state_machine = sfn.StateMachine(
self,
"MyStateMachine",
definition=tasks.LambdaInvoke(
self,
"MyLambdaTask",
lambda_function=hello_function,
integration_pattern=tasks.IntegrationPattern.WAIT_FOR_TASK_TOKEN,
payload={ "payload.$": "$",
"execution_id.$": "$$.Execution.Id",
"taskToken.$": "$$.Task.Token"},
).next(
self,
"MyStateMachine_step2",
definition=tasks.LambdaInvoke(
self,
"MyLambdaTask2",
lambda_function=hello_function,
integration_pattern=tasks.IntegrationPattern.WAIT_FOR_TASK_TOKEN,
payload={ "payload.$": "$",
"execution_id.$": "$$.Execution.Id",
"taskToken.$": "$$.Task.Token"},
)
)
)
)
on making build I am getting this error :
jsii.errors.JavaScriptError:
Error: Task Token is required in payload
for callback. Use JsonPath.taskToken to set the token. I even tried to put task token into payload but nothing is working till now
CodePudding user response:
In payload you are defining
"taskToken.$": "$$.Task.Token"},
How does your $$ look like ? Does it have a Task.Token ?
You can test it by adding a variable into payload something like (not sure about the dot after $$, just try it out :)
"everything.$": "$$."
And then in the step, check the value of "everything" and see if it has the Task.Token value.
$ = access to current step input json
$$ = access to initial stepfunction input json