【发布时间】:2022-01-15 13:50:54
【问题描述】:
我花了很多时间来解决这个问题,所有相关的 SO 答案似乎都已过时或无关紧要。
状态:
-
Amplify.js "^4.3.10" 和代码
Auth.forgotPasswordSubmit(email, confirmationCode, password) .then(_ => this.notification.success("Confirmation OK")) .catch(err => console.log(err)); -
Node.js 14 上的 Lambda
-
Cognito 触发“发布确认”
Lambda 函数代码:
'use strict';
exports.handler = async (event, context, callback) => {
if (event.triggerSource === "PostConfirmation_ConfirmForgotPassword") {
const postConfirmEmail = () => `<html><body>HERE IS MY TEMPLATE</body></html>`;
event.response = {
emailSubject: "Reset Password Notification",
emailMessage: postConfirmEmail()
};
callback(null, event);
}
};
结果,我得到了 InvalidLambdaResponseException:无法识别的 lambda 输出(错误 400)
问题是密码确实按预期更新,但未发送电子邮件确认并且错误仍然存在。
提示:用户已确认。也尝试使用“context.done(null, event);” /“返回事件;”但是响应总是出现同样的错误。
【问题讨论】:
标签: authentication aws-lambda amazon-cognito amplify