AWS boto3:认知set_ui_customization botocore.exceptions.ClientError:调用SetUICustomization操作时发生错误(413):

时间:2020-02-27 13:50:45

标签: amazon-cognito

我正在尝试从python lambda函数自定义cognito托管UI徽标,这是我的代码:

def readImage():
        with open("./utils/png-file-6-1.png", "rb") as image:
            f = image.read()
            b = bytearray(f)
            return b

我能够使用上述功能在AWS lambda中读取此文件。然后我尝试了

def set_ui_customization():
        bytes_a = readImage()
        client = boto3.client('cognito-idp', region_name=self.region_name)
        response = client.set_ui_customization(
            UserPoolId='abc',
            ClientId='pqr',
            #CSS='string',
            ImageFile=bytes_a
            )
        print('done')
        print(response)

但是低于回应。

 cognito.set_ui_customization()
  File "/var/task/utils/cognitoUtils.py", line 320, in set_ui_customization
    response = client.set_ui_customization(
  File "/var/runtime/botocore/client.py", line 272, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/var/runtime/botocore/client.py", line 576, in _make_api_call
    raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (413) when calling the SetUICustomization operation:

任何人都知道我是否错过了任何事情。

0 个答案:

没有答案