I have written a bunch of Lambda functions that are exposed as Rest endpoints through API Gateway. I have chosen the "Lambda Proxy Integration" since it seemed like a straightforward way to get started.
Now I want to chain together 2 of these functions via AWS Step Functions. The general integration and configuration works fine except how to create the proper inputs for each task.
Using the console I can start an Execution and give the following JSON:
{
"headers": {
"Authorization": "Bearer 12345"
},
"body": "\"some\": \"json\"",
"queryParameters: {
"more": "here"
}
}
This is how the inputs to my Lambda functions look like since I'm using the Lambda Proxy Integration everywhere.
The output looks something like this:
{
"isBase64Encoded": false,
"statusCode": 200,
"headers": {
"Access-Control-Allow-Origin": "*"
},
"body": "{\"message\":\"Great\"}"
}
This is also fine stand-alone, API Gateway maps these infos back to proper HTTP return codes and responses and all.
Now: how do I create these input JSONs when using Step Functions. The very first input is easy using the console, of course. But how do I create the next input and mix in a part of the previous output? Some of the problems in bullet points:
- Using InputPath, ResultPath and OutputPath I can only seem to use the "whole" output of a previous step as input or part as the input for the next step. But I can't use only a part of the output, in my case the element "body" of the response.
- This element "body" is escaped anyways so I guess I would need to un-escape it before using it somehow for the next input? But how?
- The input JSON needs to consist of elements like "headers", "body" or "queryParameters" that don't appear at all in the previous output. How do I create those?
I'm wondering whether Step Functions just don't really work with Lambdas built for the Lambda Proxy Integration. Is that the case? How are people using Step Functions without running into these problems?