AWS Rekognition not working as per the docs
collegeimprovements opened this issue · 2 comments
collegeimprovements commented
Hi Team,
I was trying to follow the generated docs for Rekognition service.
But I keep getting this error.
AWS.Rekognition.detect_text(client, "s3://s3_bucket/public/cococola/c_1001.jpg")
** (FunctionClauseError) no function clause matching in AWS.Request.encode!/3
The following arguments were given to AWS.Request.encode!/3:
# 1
#AWS.Client<
endpoint: nil,
http_client: {AWS.HTTPClient, []},
json_module: {AWS.JSON, []},
port: 443,
proto: "https",
region: "us-east-2",
service: "rekognition",
session_token: nil,
xml_module: {AWS.XML, []},
...
>
# 2
"json"
# 3
"s3://cookstro/public/cococola/c_1001.jpg"
Attempted function clauses (showing 1 out of 1):
defp encode!(%AWS.Client{} = client, protocol, payload) when protocol === "query" or protocol === "json" or protocol === "rest-json" or protocol === "rest-xml" and is_map(payload)
(aws 0.10.0) lib/aws/request.ex:233: AWS.Request.encode!/3
(aws 0.10.0) lib/aws/request.ex:42: AWS.Request.request_post/5
```
We tried with `File.read!()` as well with no success.
philss commented
Hi @collegeimprovements 👋
I think the problem is that you are passing the input in a wrong format.
Please take a look: https://docs.aws.amazon.com/rekognition/latest/dg/API_DetectText.html
and https://docs.aws.amazon.com/rekognition/latest/dg/API_S3Object.html
For the docs, your request would look like this:
AWS.Rekognition.detect_text(
client,
%{ "Image" => %{
"S3Object" => {
"Bucket" => "s3_bucket",
"Name" => "public/cococola/c_1001.jpg"
}
}
)
collegeimprovements commented
Ah, Thanks a lot @philss. I was passing string instead of object as you suggested. It works now. Thanks a lot