Cognito用户池触发器上的AWS Lambda错误 [英] AWS Lambda error on Cognito User Pool trigger

查看:113
本文介绍了Cognito用户池触发器上的AWS Lambda错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在DynamoDB中插入一条记录,以调用Cognito用户池的预注册触发器。

I'm trying to insert a record into DynamoDB invoking "Pre sign-up" trigger of Cognito User Pool.

Lambda函数对于测试而言非常简单,但是在AWSCognito.CognitoIdentityServiceProvider.CognitoUserPool.signUp调用上的客户端应用程序中始终存在错误

Lambda function is pretty simple for testing purposes but there is always an error in client application on AWSCognito.CognitoIdentityServiceProvider.CognitoUserPool.signUp call

用例1

Lambda正文:

console.log('Received event:', JSON.stringify(event, null, 2));

结果:

InvalidLambdaResponseException: Invalid lambda function output : Invalid JSON

用例2

Lambda正文:

callback("null", "success");

结果:

InvalidLambdaResponseException: Invalid lambda function output : Invalid JSON

用例3

Lambda正文:

new AWS.DynamoDB.DocumentClient().put(params, callback);

结果:

InvalidLambdaResponseException: Invalid cognito sign in version. Version should be 1

那么,有什么想法可能有问题吗?

So, any ideas what might be wrong?

最新的错误可能与Cognito用户池的beta状态有关吗?

Could the latest error might be related to the beta status of Cognito User Pool?

PS如果需要,我将提供更多详细信息。

P.S. I will provide more details if needed. Thanks in advance.

推荐答案

您正在node.js中执行此操作,并且错误指示您未返回预期的服务事件源

You are doing this in node.js and the error indicates you are not returning the service expected event source.

您应该在lambda函数完成执行后调用context.done()。另外,在Cognito用户池服务生成的任何触发源中,您只能编辑源的响应部分。例如,PreSignUp触发源中的 autoConfirmUser标志。

You should call context.done() when your lambda function finishes execution. Also, in any of the trigger sources which Cognito User Pool service generates, you can only edit the "response" part of the the source. For example, "autoConfirmUser" flag in PreSignUp trigger source.

请参阅我们的开发人员指南

这篇关于Cognito用户池触发器上的AWS Lambda错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆