AWS Step Functions with JSONata query language supports passing a JSONata expression as the entire Payload value in a Lambda invoke task (docs):
The Arguments and Output fields (and other similar fields) will accept either a JSON object or a JSONata expression directly.
However, LambdaInvokeArgs.payload is typed as Record<string, Input<unknown>>, which only accepts objects. This forces a @ts-expect-error workaround:
const task = sst.aws.StepFunctions.lambdaInvoke({
name: "FetchBatch",
function: myFn,
// @ts-expect-error: payload should accept JSONata expressions
payload: "{% $states.input %}",
});
StateArgs.output already handles this correctly:
// state.ts
output?: Input<JSONata | Record<string, any>>;
Suggested fix: #6583
In platform/src/components/aws/step-functions/task.ts, change:
payload?: Record<string, Input<unknown>>;
to:
payload?: Input<JSONata | Record<string, Input<unknown>>>;