首页 > 解决方案 > 间歇性'NoAuthHandlerFound' boto 错误 | django + kinesis 客户端

问题描述

即使在尝试解决方案之后:Boto3 间歇性 NoAuthHandlerFound 错误得到以下错误:

[Tue Aug 04 12:55:09.460312 2020] [wsgi:error] [pid 24727:tid 140597795952384]     creds = self._get_credentials_from_metadata(metadata)
[Tue Aug 04 12:55:09.460342 2020] [wsgi:error] [pid 24727:tid 140597795952384]   File "/usr/local/lib/python3.5/dist-packages/boto/provider.py", line 424, in _get_credentials_from_metadata
[Tue Aug 04 12:55:09.460373 2020] [wsgi:error] [pid 24727:tid 140597795952384]     "%s" % (msg))
[Tue Aug 04 12:55:09.460415 2020] [wsgi:error] [pid 24727:tid 140597795952384] boto.exception.InvalidInstanceMetadataError: Expected a dict type of credentials instead received an empty string
[Tue Aug 04 12:55:09.460450 2020] [wsgi:error] [pid 24727:tid 140597795952384] You can set the 'metadata_service_num_attempts' in your boto config file to increase the number of times boto will attempt to retrieve credentials from the instance metadata service.

AWS_METADATA_SERVICE_NUM_ATTEMPTS在机器上和 django settings.py 中都设置为 4。当我在代码中尝试手动重试时,它可以工作,但响应时间太长,并且请求排队并抛出 502、503 错误。

注意:身份验证是通过 IAM 角色进行的。

标签: pythondjangoboto3botoamazon-kinesis

解决方案


推荐阅读