Thanks for your work in Waffle, I’m newbie in Elixir, Using Arc I had this error
02:45:58.484 [warn] ExAws: HTTP ERROR: :nxdomain for URL: "https://s3.amazonaws.comuploads/company_logo/2e24af00-a7ad-4bd9-b5e2-8328f2690a9b_original.png?uploads=1" ATTEMPT: 10
I changed to use Waffle and I still get the same error.
This is really weird, because I tested in my local machine and it works. I’m using Phoenix, run the server in production mode and the image is uploaed to S3 successfully. But in production I have a E2 instance and I get the same error :nxdomain.. etc.
.
As you can see in the url the bucket name doesn’t appear, and also the host
is joined with the uploads/company_logo
directory.
I’m not sure if this is an issue of the ex_aws
or is a issue that comes from Arc.
This is part of my code, if you can help me, I really appreciate, thanks!!
# The waffer_ecto module
defmodule Datasets.Storage.CompanyLogo do
use Waffle.Definition
use Waffle.Ecto.Definition
@versions [:original, :thumb]
@extension_whitelist ~w(.jpg .jpeg .gif .png)
def validate({file, _}) do
file_extension = file.file_name |> Path.extname |> String.downcase
Enum.member?(@extension_whitelist, file_extension)
end
def transform(:thumb, _) do
{:convert, "-thumbnail 100x100^ -gravity center -extent 100x100 -format png", :png}
end
def filename(version, {_file, scope}) do
"#{scope.uuid}_#{version}"
end
def storage_dir(_, {_, _}) do
"uploads/company_logo"
end
end
# config/prod.exs
# AWS Credentials
config :ex_aws,
access_key_id: [{:system, "AWS_ACCESS_KEY_ID"}, :instance_role],
secret_access_key: [{:system, "AWS_SECRET_ACCESS_KEY"}, :instance_role],
json_codec: Jason
# Mailer using AWS
config :web, Mailer.Dispatcher, adapter: Bamboo.SesAdapter
# Waffle config
config :waffle,
storage: Waffle.Storage.S3,
bucket: {:system, "S3_BUCKET"}