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
エキスパート
レビュー済み 1ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ