2021年5月5日星期三

Using Elasticsearch on Lex fulfillment Lambda function

I'm trying to put a elastic search result as an answer from a lex bot. I'm using Lambda function for my fullfilment, so I tried to initiate ES on lambda, but the aws_auth seems to cause problems. Whenever I add below code in Lambda, the lex responds with An error has occurred: The server encountered an error processing the Lambda response.

The added code possibly causing problem:

from aws_requests_auth.aws_auth import AWSRequestsAuth  from elasticsearch import Elasticsearch, RequestsHttpConnection    awsauth = AWSRequestsAuth(aws_access_key=credentials.access_key,                            aws_secret_access_key=credentials.secret_key,                            aws_host=es_endpoint,                            aws_token=session_token=credentials.token,                            aws_region='us-east-1',                            aws_service='es')  

I have added layers for both the aws_auth and elasticsearch.

Is there a way to fix this? Is there a way to not use aws_auth in the code, go around it?

Thank you in advance.

https://stackoverflow.com/questions/67411275/using-elasticsearch-on-lex-fulfillment-lambda-function May 06, 2021 at 11:04AM

没有评论:

发表评论