"Unknown parameter in input: "QueriesConfig", must be one of: Document, FeatureTypes, HumanLoopConfig" while using 'QUERIES' feature type in Textract

3

I have followed the boto3 documentation version 1.23.1 and used analyze_document method for synchronous analysis from lambda. I have followed the code snippet given here. I need to pass custom queries to textract via QueriesConfig parameter, but it raises "Unknown parameter" error. I cannot find any reference for this error here.

3 個答案
1

Ensure that your lambda function is using the latest version of boto3 by packaging it with your code. For example v1.21.1 of boto3 does not contain QueriesConfig argument https://boto3.amazonaws.com/v1/documentation/api/1.21.1/reference/services/textract.html#Textract.Client.analyze_document

AWS
專家
已回答 2 年前
  • Hi, I am using boto3 version 1.23.1. Issue is still there when I tried calling inside a dockerised lambda function. Boto3 version in requirements is 1.23.1, python image public.ecr.aws/lambda/python:3.8. However the issue got resolved when I call it from local environment.

  • I have the same issue with boto3 version 1.24.34, and lambda image py3.9, thus, this is not the issue. In my case Forms works, but Queries not. Could you help us to solve this issue?

1

Follow the instructions here to use the most recent version of boto3 by adding a Layer:

https://docs.aws.amazon.com/textract/latest/dg/lambda.html

Another good reference is here: https://aws.amazon.com/premiumsupport/knowledge-center/lambda-python-runtime-errors/

In my case, the boto3 version is updated to 1.24.96.

Tip: Use print(boto3.version) and print(botocore.version) in your function code to confirm the version of Boto 3 and Botocore.

AWS
Pengfei
已回答 2 年前
0

I was facing same issue and I am able to solve it by creating a lambda layer for latest boto3 library and adding it to my function. Followed the steps mention in this blog post https://aws.amazon.com/premiumsupport/knowledge-center/lambda-python-runtime-errors/

1.    Create a lib folder by running the following command: LIB_DIR=boto3-mylayer/python mkdir -p $LIB_DIR 2.    Install the library to LIB_DIR by running the following command: pip3 install boto3 -t $LIB_DIR 3.    Zip all the dependencies to /tmp/boto3-mylayer.zip by running the following command: cd boto3-mylayer zip -r /tmp/boto3-mylayer.zip .

4.    Publish the layer by running the following command:

aws lambda publish-layer-version --layer-name boto3-mylayer --zip-file fileb:///tmp/boto3-mylayer.zip --compatible-runtimes python3.6 python3.7 python3.8 --compatible-architectures "arm64" "x86_64"

AWS
已回答 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南