I'm using AWS CDK Step Function constructs to create a simple workflow. I can invoke the first Lambda fine and that subsequently invokes next Lambda. However, on the second Lambda my input is fine as expected but the output from lambda task always returns Payload: null as response. I do not intend this behaviour and want to return data inside the Lambda via output key to be passed to next task.
export const bulkSummaryHandler = (event) => {
try {
console.log('LAMBA SUMMARY!', event);
return { output: { status: 'finished' } };
} catch (error) {
return handleError(error);
}
};
My CDK code
const getUserCsvFileTask = new tasks.LambdaInvoke(ctx.stack, 'getUserCsvFileTask', {
lambdaFunction: getUserCsvFileFn,
comment: 'fetch user uploaded csv from csv-integration-service',
inputPath: '$',
resultPath: '$.taskResult',
outputPath: '$.taskResult.Payload'
});
const bulkSummaryTask = new tasks.LambdaInvoke(ctx.stack, 'bulkProcessingSummaryTask', {
lambdaFunction: bulkSummaryFn,
comment: 'summarise bulk processing',
inputPath: '$'
});
const definition = stepfunctions.Chain.start(getUserCsvFileTask).next(bulkSummaryTask).next(nextLambdaTask);
The response I get from second Lambda 'bulk summary task' invoked in Payload Key is always null. It's not clear to me why I am getting null and I'm out of ideas as to why. Any ideas would be great help.
{
"ExecutedVersion": "$LATEST",
"Payload": null,
"SdkHttpMetadata": {
"AllHttpHeaders": {
"X-Amz-Executed-Version": [
"$LATEST"
],
"x-amzn-Remapped-Content-Length": [
"0"
],
"Connection": [
"keep-alive"
],
"x-amzn-RequestId": [
"fed8b1bd-d188-4425-ade7-ce2723aef4c8"
],
"Content-Length": [
"4"
],
"Date": [
"Wed, 21 Sep 2022 22:54:00 GMT"
],
"X-Amzn-Trace-Id": [
"root=1-632b9607-0e451e4c5dd4c21c7a3eaa8b;sampled=1"
],
"Content-Type": [
"application/json"
]
},
"HttpHeaders": {
"Connection": "keep-alive",
"Content-Length": "4",
"Content-Type": "application/json",
"Date": "Wed, 21 Sep 2022 22:54:00 GMT",
"X-Amz-Executed-Version": "$LATEST",
"x-amzn-Remapped-Content-Length": "0",
"x-amzn-RequestId": "fed8b1bd-d188-4425-ade7-ce2723aef4c8",
"X-Amzn-Trace-Id": "root=1-632b9607-0e451e4c5dd4c21c7a3eaa8b;sampled=1"
},
"HttpStatusCode": 200
},
"SdkResponseMetadata": {
"RequestId": "fed8b1bd-d188-4425-ade7-ce2723aef4c8"
},
"StatusCode": 200
}