I've created a function in an AWS lambda that invokes a second lambda function using a LambdaCall.
public InvokeResult invokeResponse() {
InvokeResult invokeResult = lambdaCall.invokeLambda(invokeRequestParameters.getFunctionName(), invokeRequestParameters.getPayload());
return invokeResult;
}
The payload is a string "Version". In the second lambda, the handleRequest code contains is:
public String handleRequest(InputStream inputStream, Context context) {
ObjectMapper mapper = new ObjectMapper();
try {
String text = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)).lines().collect(Collectors.joining("\n"));
if (text.equals("\"Version\"")) {
VersionResponse versionResponse = getVersion();
return mapper.writeValueAsString(versionResponse);
}
return null;
} catch (Exception error) {
LOGGER.info(error);
return null;
}
VersionResponse is a simple POJO and I've confirmed that getVersion is returning the VersionResponse object. Currently the Lambda is retrieving the "Version String" and getVersion is working fine. However, when the string is returned the InvokeResult has a null payload. Any idea what I'm doing wrong?