-
I'm working on a demo project to extract information from medical exams using Amazon Textract. Initially, I used the Now, I'm trying to use Textract's Queries feature by passing a list of Query objects to An error occurred: Request has invalid parameters
Here’s the relevant code from my service class:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Hey there. Taking a look at your issue and I notice a potential problem. I think the issue may be with how you are handling the MemoryStream:
After calling A couple solutions I see are:
Or, alternatively, you could just create a new MemoryStream from your byte array:
Could you give either of these a try and let us know if it resolves your issue? Also! It's always reccomended to make use of AWS's credential providers rather than hard-coding your keys. |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
Oh I forgot to comment here how I fixed the issue, I did notice this mistake you pointed and fixed it afterwards. However the problem persisted. With the information I initially provided, no one would have been able to guess it (sorry about that!).
Root Cause
The issue was with the
Text
field in theQuery
objects I was sending to Textract:Textract's
Query.Text
field does not accept special characters like accents (e.g., á, é, ã, etc.).I was passing queries like "Exame de Próstata" or "Coração" which contain accented characters. Once I removed all accents from the Text values (e.g., changed "Próstata" to "Prostata"), everything worked fine. Thanks for the help