I’m uploading multiple photos to AWS using a HTML form. Those files sizes are range from 5mb to 100mb. Each one of the photo is processed using the ID for image detection. Some of the photos are fine. However when the file is larger, it timeout during the image processing.
Let’s say I’m uploading 5 photos at a same time. For instance some photos are successfully processed but others throws the error.
Code:
def process_image(id) do
base_url = "https://<<image-processing-api>>/img_process"
headers = %{Accepts: "application/json", Authorization: "Key #{api_key()}"}
img_url = "https://#{domain()}/media/#{id}"
body = Poison.encode!(%{inputs: [%{data: %{image: %{url: img_url}}}]})
{:ok, response} = HTTPoison.post(base_url, body, headers, [recv_timeout: 120000, timeout: 120000])
case response.status_code do
200 ->
{:ok, response.body}
_ ->
{:error, response.status_code}
end
end
Error:
Request: POST /api/media/upload
** (exit) an exception was raised:
** (MatchError) no match of right hand side value: {:error, %HTTPoison.Error{reason: :timeout, id: nil}}
Is it something to do with ssl
for HTTPoison
options?