Cognito后确认功能未触发
我正在使用无服务器和AWS lambda/cognito注册用户,并在用户注册后发送确认电子邮件。为此,我在server> serverless.yml
中创建了postenfiration
函数>在post postef -Condercration
cognito事件之后触发,但是该函数dimn是't似乎完全被打电话。有什么问题?
serverless.yml
...
postConfirmation:
description: Cognito handler for when a user is confirmed, here it is used for storing the data to database and sending a confirmation email
name: "${self:service}-users-post-confirmation-cognito-trigger-${self:provider.stage}"
handler: src/service/users/postConfirmationTrigger.handler
dependsOn:
- CognitoUserPoolMyUserPool
events:
- cognitoUserPool:
pool: ${self:service}-user-pool-${self:provider.stage}
trigger: PostConfirmation
existing: true
我正在尝试查看是否完全调用后确认处理程序:
exports.handler = (event, context, callback) => {
console.log(`this function fires!`)
console.log(event)
}
但是我在日志中看不到任何内容。不确定如何触发处理程序
I'm signing up users to my application using serverless and AWS Lambda/Cognito, and I'd like to send a confirmation email after the users sign up. To do this, I created a postConfirmation
function definition in my serverless.yml
to be triggered after the postConfirmation
Cognito event fires, but that function doesn't seem to get called at all. What could be the issue?
serverless.yml
...
postConfirmation:
description: Cognito handler for when a user is confirmed, here it is used for storing the data to database and sending a confirmation email
name: "${self:service}-users-post-confirmation-cognito-trigger-${self:provider.stage}"
handler: src/service/users/postConfirmationTrigger.handler
dependsOn:
- CognitoUserPoolMyUserPool
events:
- cognitoUserPool:
pool: ${self:service}-user-pool-${self:provider.stage}
trigger: PostConfirmation
existing: true
I'm trying to see if the postConfirmation handler is called at all:
exports.handler = (event, context, callback) => {
console.log(`this function fires!`)
console.log(event)
}
but I don't see anything in the logs. Not sure how to trigger the handler
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看起来像是经典的Lambda回调问题。您的lambda完成回调之前就完成了。尝试一下:
或者
还确保您的lambda配置已设置,以免超时。默认值为3s通常太短。
Looks like a classic Lambda callback issue. Your Lambda is finishing before a callback is completed. Try this:
or this
Also make sure your Lambda configuration is setup so that it doesn't timeout. The default is 3s which is often too short.
确认后的lambda被触发时,当用户被确认不仅是注册时,
因此,通过使用控制台设置自动化电子邮件后,请确保用户在注册后验证他的电子邮件或电话号码:
或使用serverless:
PostConfirmation Lambda is triggered when the user is confirmed not only signup,
so make sure that the user verifies his email or phone number after signup by setting autoVerify email using console:
Or using serverless: