javascript – cognitoUser.getAttributeVerificationCode Generates an error "Invalid lambda function output: Invalid JSON"

I've tried checking the user's email with the help of the getAttributeVerificationCode API in Amazon Cognito. This is my code.

cognitoUser.getAttributeVerificationCode (& # 39; email;
onSuccess: function (result) {
// console.log ("type", typeof params.AttributeName);
console.log ("result of the call:" + result)
answer = {
statusCode: 200,
body: JSON.stringify ({message: onSuccess}),
headers: {
& # 39; Content-Type & # 39 ;: application / json & # 39;
}
}
reminder (null, answer)
}
onFailure: function (err) {
// console.log (err)
answer = {
statusCode: 200,
body: JSON.stringify ({message: err.message}),
headers: {
& # 39; Content-Type & # 39 ;: application / json & # 39;
}
}
reminder (null, answer)
}
inputVerificationCode: function () {
// var verificationCode = prompt (& # 39;) Please enter the verification code: & # 39;; & # 39;);
// cognitoUser.verifyAttribute (& # 39; email; verificationCode, this);
console.log (& # 39; verification code & # 39;)
}

})

This indicates the error "Invalid lambda function output: Invalid JSON". Any help would be appreciated.