我有一个在API网关和Lambda函数上运行的flaskapi,其中Lambda函数是configured to run in my VPC。你知道吗
我的Lambda函数的正常持续时间应该是3秒左右,但有时它会达到130秒或更多,这会导致我的API网关返回504。你知道吗
Lambda函数使用requests
库发出GET请求:
url = base_url + endpoint
req = requests.get(url, headers=headers)
response = json.loads(req.content.decode('utf-8'))
CloudWatch在超时的请求上显示以下错误:
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='host', port=port): Max retries exceeded with url: /foo/bar (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at foo>: Failed to establish a new connection: [Errno 110] Connection timed out'))
我读过的大多数帖子都提到在私有子网中运行的Lambda函数配置不正确,但我知道这不是我的问题,因为我的函数可以访问internet。你知道吗
我的另一个理论是会话在函数的底层容器上被重用,这会导致超时。你知道吗
提前谢谢你的帮助!你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐