Skip to content

StartDocumentTextDetectionRequest : Request has invalid parameters

0

I am attempting to StartDocumentTextDetectionRequest but am getting the error of "Exception: Request has invalid parameters, Document: 2019/1/2/Document Name.pdf". Below is the code and the result. Any thoughts on what I am doing wrong? I am getting the correct file with path in the output while only providing root bucket and file name. I also have tried multiple variations of bucket, file name and path.

using (AmazonTextractClient client = new AmazonTextractClient(RegionEndpoint.USEast1))
{
    var bucket = doc.Bucket;
    var name = Path.GetFileName(doc.Path);
    
    context.Logger.LogLine($"Bucket: {bucket}");
    context.Logger.LogLine($"Name: {name}");
    
    StartDocumentTextDetectionRequest request = new StartDocumentTextDetectionRequest
    {
        DocumentLocation = new DocumentLocation
        {
            S3Object = new S3Object
            {
                Bucket = bucket,
                Name = name
            }
        },
        NotificationChannel = new NotificationChannel
        { 
            SNSTopicArn = "arn:aws:sns:us-east-1:RemovedForPublicPost"
        }
    };
    StartDocumentTextDetectionResponse response = await client.StartDocumentTextDetectionAsync(request);
    if ((int)response.HttpStatusCode < 200 || (int)response.HttpStatusCode > 299)
        throw new Exception($"Failed to Queue Text Detection: {response.JobId}, with status: {response.HttpStatusCode.ToString()}");
} 
Bucket: companyName.docs 
Name: Document Name.pdf
Exception: Request has invalid parameters, Document: 2019/1/2/Document Name.pdf 
asked 7 years ago511 views
3 Answers
0

I had this exact same issue yesterday with both StartDocumentTextDetection and StartDocumentAlaysis. I'm pretty sure i tried this yesterday, but this morning, i removed the Notification block and it was accepted and is being analyzed. Which leads me to think the role/assume-role is not configured correctly, or there is a bug in that portion of the api.

So for now i'm just writing a parser to pull all pages based on NextToken. Which i would need to do anyway.

Hope this helps.
Jeff

answered 7 years ago
0

Interesting, I am not sure I would have found that on my own. Sure enough though removing the NotificationChannel revealed another permissions error. Back to IAm I guess. Thank you.

answered 7 years ago
0

I missed passing the RolARN to the NotificationChannel object. I am getting a successful post to StartDocumentTextDetectionAsync now. Now I get to figure out why my SNS Topic is never getting anything. But at least it's progress.

answered 7 years 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.