Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Aws lambda aws注册无效AmbdareSponseException_Aws Lambda_Amazon Cognito - Fatal编程技术网

Aws lambda aws注册无效AmbdareSponseException

Aws lambda aws注册无效AmbdareSponseException,aws-lambda,amazon-cognito,Aws Lambda,Amazon Cognito,我在注册用户时遇到此错误: 调用注册操作时发生错误(InvalidLambdaResponseException):无法识别的lambda输出 我的代码: from __future__ import print_function import json import boto3 import botocore.exceptions import hmac import hashlib import base64 import json import uuid client = None

我在注册用户时遇到此错误:

调用注册操作时发生错误(InvalidLambdaResponseException):无法识别的lambda输出

我的代码:

from __future__ import print_function
import json
import boto3
import botocore.exceptions
import hmac
import hashlib
import base64
import json
import uuid


client = None

USER_POOL_ID = 'us-east-2_ssqaX****';
CLIENT_ID = '40kq19dp3tgaost148115****';
CLIENT_SECRET = '1rbns01jnv2ckiu1so8ntqjt8l6r****lgq2a4hni642s*****';



ERROR = 0
SUCCESS = 1
USER_EXISTS = 2


def get_secret_hash(username):
msg = username + CLIENT_ID
dig = hmac.new(str(CLIENT_SECRET).encode('utf-8'), 
    msg = str(msg).encode('utf-8'), digestmod=hashlib.sha256).digest()
d2 = base64.b64encode(dig).decode()
print("here" + d2)
return d2




def lambda_handler(event, context):

global client
if client == None:
    client = boto3.client('cognito-idp')

body = event
username = body['username']
password = body['password']

resp = client.sign_up(
ClientId=CLIENT_ID,
SecretHash=get_secret_hash(username),
Username=username,
Password=password
)

return {"resp": resp}

调用注册操作时发生错误(InvalidLambdaResponseException):无法识别的lambda输出:InvalidLambdaResponseException

CloudWatch日志中有什么?你的Lambda代码在哪?我编辑过。。。发布了完整的代码。