Skip to content

UnknownOperationException

0

Hello,

I'm working on a google chrome extension project right now which involves extracting text from .pdf sites. such as the examples below:

https://m.media-amazon.com/images/I/51j-A1KtRSL.pdf https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf

I tried everything along with Cedric's debugging and could not come up with a solution or reason behind this error even after reading the related questions here and most of the documentations and FAQs. These are the console logs pulled using Cedric.

5:04:40 PM - Fetching PDF from: https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf 5:04:40 PM - Converting PDF to Base64... 5:04:40 PM - Base64 Encoded PDF Size: 17688 characters 5:04:40 PM - Popup: Sending to AWS Textract... 5:04:40 PM - Sending request to AWS Textract... 5:04:40 PM - Generating AWS Signature... 5:04:40 PM - Canonical Request: POST / content-type:application/x-amz-json-1.1 host:textract.us-east-1.amazonaws.com x-amz-content-sha256:UNSIGNED-PAYLOAD x-amz-date:20250325T140440Z content-type;host;x-amz-content-sha256;x-amz-date UNSIGNED-PAYLOAD 5:04:40 PM - String To Sign: "No errors - hidden" 5:04:40 PM - Deriving Signing Key... 5:04:40 PM - AWS Signature: "No errors - hidden" 5:04:40 PM - Request Headers: "No errors - Hidden" 5:04:41 PM - AWS Response: { "Output": { "__type": "com.amazon.coral.service#UnknownOperationException" }, "Version": "1.0" } 5:04:41 PM - No text found.

Using S3 bucket is not an option currently. I can provide the code snippet directly here or privately if requested.

1 Answer
0

The error you're encountering suggests that there might be an issue with how you're calling the Amazon Textract API. The "UnknownOperationException" typically indicates that the operation you're trying to perform is not recognized by the service.

When working with PDFs in Amazon Textract without using S3, you need to use the synchronous API calls, specifically the DetectDocumentText operation for text extraction. However, it's important to note that the synchronous API only supports single-page documents.

Here are a few things to check:

  1. Ensure you're using the correct API endpoint for Textract.
  2. Verify that you're calling the correct operation (DetectDocumentText for synchronous text detection).
  3. Make sure your PDF is single-page. If it's multi-page, you'll need to split it or use the asynchronous API with S3.
  4. Check that your AWS credentials and permissions are correctly set up to allow Textract operations.
  5. Ensure the PDF is properly Base64 encoded before sending it to Textract.

If you're certain that all of these are correct, you might want to try converting the PDF to an image format (like PNG) before processing, as Textract sometimes works better with images.

Remember that for synchronous operations, Textract charges per document rather than per page, which can be more expensive for multiple single-page documents compared to asynchronous processing of a multi-page document.

If the issue persists after checking these points, you may need to review your code for any API formatting issues or consult AWS support for more specific troubleshooting.
Sources
Not authorized to perform textract:DetectDocument | AWS re:Post
Async Vs Individual Analysis of Documents in Textract | AWS re:Post
Textract Error With Multiples Pages | AWS re:Post
Textract too slow for a single page PDF | AWS re:Post

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.