How can I write an "AWS Lambda response" in Java so that Cognito is happy?
Something like this is passed to the lambda function
{
"version": number,
"triggerSource": "string",
"region": AWSRegion,
"userPoolId": "string",
"callerContext":
{
"awsSdkVersion": "string",
"clientId": "string"
},
"request":
{
"userAttributes": {
"string": "string",
....
}
},
"response": {}
}
Now I need to make the response in Java.. and send back to Cognito. At the moment Cognito throws an "InvalidLambdaResponseException".
Java code below just returns the event..
public class LambdaFunctionHandler implements RequestHandler<CognitoEvent, CognitoEvent>
{
@Override
public CognitoEvent handleRequest(CognitoEvent arg0, Context arg1)
{
return arg0;
}
}