I have created step functions and invoked them as specified in AWS documentation. For output, I am getting
{
"executionArn": "arn:aws:states:us-east-1:123456789012:execution:HelloWorld:MyExecution", "startDate": 1385732956.878
}
But, instead of above response I want my API response
{ response: DATA}
How can I achieve this?
EDIT: This is the lambda that triggers the state machine:
import * as AWS from 'aws-sdk';
import {APIGatewayEvent} from 'aws-lambda';
const stepFunctions = new AWS.StepFunctions();
export const handler = (event: APIGatewayEvent) => {
console.log('event: ' + JSON.stringify(event));
const stateMachineARN = process.env.MACHINE_ARN;
const params = {
stateMachineArn: stateMachineARN,
input: JSON.stringify(event),
};
const request = stepFunctions.startExecution(params);
request.on('error', err => {
console.log('aca' + err.message);
});
request.send();
};
And the output of the state machine:
{
"ExecutedVersion": "$LATEST",
"Payload": {
"isBase64Encoded": false,
"statusCode": 200,
"headers": {},
"body": {
"endpoint": {
"url": "xxx",
"method": "POST",
"request": "xxx"
}
}
},
I need to grab that Payload.