Textract Error When PDF Is Uploaded to Folder

0

Hi,

I currently have a Lambda that is triggered upon uploading a PDF document to an S3 bucket. Once called, the Lambda calls the start_document_text_detection method to extract the document text. The job gets published to an SNS topic and another Lambda gets triggered on completion to get_document_text_detection method to retrieve the results and upload it into said bucket.

If I upload a document to the root of the S3 bucket, everything works great. My issue is that when I create a folder within the S3 bucket and upload a PDF there, the trigger fires but I am getting the following error :

[ERROR] InvalidParameterException: An error occurred (InvalidParameterException) when calling the StartDocumentTextDetection operation: Request has invalid parameters
Traceback (most recent call last):
  File "/var/task/lambda_function.py", line 33, in lambda_handler
    raise e
  File "/var/task/lambda_function.py", line 26, in lambda_handler
    'SNSTopicArn': os.environ['sns_arn']
  File "/opt/python/botocore/client.py", line 357, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/opt/python/botocore/client.py", line 661, in _make_api_call
    raise error_class(parsed_response, operation_name)

SNSTopicARN being part of the NotificationChannel argument to the start_document_text_detection call. The RoleARN also has FullSNSAccess policy and the JobTag is the document name if that helps. I checked the limits of Textract and everything is within bounds. I also tried adjusting the prefix in the Events property of the S3 bucket to match the folder, with no luck.

Any advice would be appreciated.

질문됨 4년 전671회 조회
1개 답변
0
수락된 답변

Hi, Thank you for reaching out to us!

As per the error log shared in the post, it looks like the failure is triggered because the SNSTopicArn is probably not be getting set correctly. Could you check if the environment variable 'sns_arn' contains the intended ARN?

Regards,
Srikanth.

답변함 4년 전
profile picture
전문가
검토됨 한 달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠