首页 > 解决方案 > 用于弹性搜索清理 Python 的 AWS lambda 问题

问题描述

我在我的组织中继承了一段 lambda,它没有处理以下错误,它作为 python Lambda 代码运行,因为每天都作为 cron 作业触发:

aws lambda invoke --function-name es-cleanup-lambda outfile --payload '{"es_endpoint":"search-t-1.es.amazonaws.com"}'

{"errorMessage": "'AWSPreparedRequest' object has no attribute 'hooks'", "errorType": "AttributeError", "stackTrace": [["/var/task/es-cleanup.py", 169, "lambda_handler", "for index in es.get_indices():"], ["/var/task/es-cleanup.py", 154, "get_indices", "return self.send_to_es(\"/_cat/indices\")"], ["/var/task/es-cleanup.py", 125, "send_to_es", "res = session.send(preq)"], ["/var/runtime/botocore/vendored/requests/sessions.py", 634, "send", "hooks = request.hooks"]]

不知道为什么 AWSprepared 方法调用缺少钩子,我们认为我现在需要以某种方式更新 boto Lib。

标签: pythonamazon-web-serviceselasticsearchaws-lambda

解决方案


推荐阅读