Javascript cognitoUser.GetAttributeReferenceCode抛出错误“;无效的lambda函数输出:无效的JSON“;

Javascript cognitoUser.GetAttributeReferenceCode抛出错误“;无效的lambda函数输出:无效的JSON“;,javascript,node.js,aws-lambda,amazon-cognito,Javascript,Node.js,Aws Lambda,Amazon Cognito,我一直在尝试使用AmazonCognito中的GetAttributeReferenceCodeAPI验证用户电子邮件。这是我的密码 cognitoUser.getAttributeVerificationCode('email', { onSuccess: function (result) { // console.log("type",typeof params.AttributeName); console.log('call result: ' + result) resp

我一直在尝试使用AmazonCognito中的GetAttributeReferenceCodeAPI验证用户电子邮件。这是我的密码

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

这显示了错误“无效的lambda函数输出:无效的JSON”。任何帮助都将不胜感激