0

I am trying to run the Document analysis request with the use of an S3 bucket, but it is giving me an internal error. I extracted table values from a document. Here is my code. Please note and using the AWS SDK for .Net.

public async Task<IActionResult> Index()
    {

        var res = await StartDocumentAnalysis(BucketName, S3File, "TABLES");
        return View();
    }


public async Task<string> StartDocumentAnalysis(string bucketName, string key, string featureType)
    {

        var request = new StartDocumentAnalysisRequest();
        var s3Object = new S3Object
        {
            Bucket = bucketName,
            Name = key
        };
        request.DocumentLocation = new DocumentLocation
        {
            S3Object = s3Object
        };
        request.FeatureTypes = new List<string> { featureType };
        var response = _textract.StartDocumentAnalysisAsync(request).Result;
        WaitForJobCompletion(response.JobId, 5000);
        return response.JobId;
    }

Error message:

Internal error Unable to get object metadata from S3. Check object key, region and/or access permissions in aws Textract awssdk.core

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
  • Looks like error is pretty descriptive, did you checked that * Key exists in the bucket * You have rights to read the object metadata? – Milan Gatyás Sep 23 '20 at 08:43
  • @MilanG I think permissions might be the issue here. I am using an IAM user but i am still navigating AWS as i am new to it. The particular user has administrator rights. However since this is for testing purposes, i made the bucket public hoping that it would temporarily fix the issue but it hasn't. – Thuso Macdonald Rampedi Sep 25 '20 at 09:21
  • We can't help you more until you will provide more details - how you instantiate the `_textract` object, what are `bucketName` and `key` values, how S3 bucket looks and what is it's congifuration, etc. – Milan Gatyás Sep 25 '20 at 10:35
  • @MilanGatyas The following is the code for the _textract object. BucketName is the the name of the S3 bucket where my document is stored. The key is the name of the document in the bucket. IAmazonTextract _textract; public TextractController(IAmazonTextract textract) { _textract = textract; } – Thuso Macdonald Rampedi Sep 28 '20 at 07:45

0 Answers0