Hello, I’m having a problem configuring ARC to work in my app. First, when I use the configuration as described below, the file is loaded into local storage. If I add the line
def __storage, do: Arc.Storage.Local
to uploader.ex
, I get an error – not too informative: “something went wrong.” Also, when I try a direct upload, here is what happens:
iex(2)> Avatar.store("/Users/carlson/Downloads/jupiter.jpg")
{:ok, "jupiter.jpg"}
However, when I check my S3 bucket, I find only a few old items. And nothing is added to local storage
- CONFIG
# files: config.dev, config.prod
config :arc,
storage: Arc.Storage.S3,
bucket: "noteimages"
config :ex_aws,
access_key_id: System.get_env("AWS_ACCESS_KEY_ID"),
secret_access_key: System.get_env("AWS_SECRET_ACCESS_KEY")
- MIX.EXS
# file: mix.exs:
defp deps do
[{:phoenix, "~> 1.2.1"},
{:phoenix_pubsub, "~> 1.0"},
{:phoenix_ecto, "~> 3.0"},
{:postgrex, ">= 0.0.0"},
{:phoenix_html, "~> 2.6"},
{:phoenix_live_reload, "~> 1.0", only: :dev},
{:gettext, "~> 0.11"},
{:cowboy, "~> 1.0"},
{:comeonin, "~> 2.0"},
{:mnemonix, "~> 0.2.0"},
{:timex, "~>3.0"},
{:timex_ecto, "~> 3.0"},
{:benchfella, "~> 0.3.2"},
{:json, "~> 1.0"},
{:joken, "~> 1.1"},
{:arc, "~> 0.8.0"},
{:arc_ecto, "~> 0.4", override: true},
{:shared, in_umbrella: true},
{:ex_aws, "~> 1.1"},
{:poison, "~> 2.0"},
{:httpoison, "~> 0.11"},
{:hackney, "~> 1.6"}]
end
- S3 Bucket policy
{
"Version": "2012-10-17",
"Id": "Policy1493266128611",
"Statement": [
{
"Sid": "Stmt1493266101437",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::noteimages/*"
}
]
}