我的注册前触发 lambda 失败并出现 InvalidLambdaResponseException。使用节点。用户注册无需触发器即可工作。
我尝试了几乎所有关于如何处理此触发器的建议的解决方案。我尝试用 context.done(null, event) 和 callback(null, event) 结束 lambda。测试脚本有效。值得一提的是,我有大约 10 个用户属性,包括 7 个自定义属性。
exports.handler = (event, context, callback) => {
// Check if business phone exists
event.response.autoConfirmEmail = false;
// This example uses a custom attribute "custom:domain"
if (event.request.userAttributes.hasOwnProperty("custom:business_phone")) {
if ( event.request.userAttributes["custom:business_phone"] !== null
&& event.request.userAttributes["custom:business_phone"] !== "") {
event.response.autoConfirmEmail = true;
}
}
// Return to Amazon Cognito
callback(null, event);
//context.done(null, event);
};
测试事件有效,但浏览器中的用户注册返回 InvalidLambdaResponseException。尝试了最后两行中的一个或两个。
更新:为 Post Confirm 触发器获得相同的异常。按原样使用 aws doc 示例。使用运行时 NodeJs 10.x。也试过8.10。
各位高手,请大家帮忙!