我在配置ARC在我的應用程序中工作時遇到問題。首先,當我使用如下所述的配置時,文件被加載到本地存儲中。如果我添加行ARC(在Elixir應用程序中)不會上傳到S3
def __storage, do: Arc.Storage.Local
到uploader.ex
,我得到一個錯誤 - 沒有太多信息:「出事了。」此外,當我嘗試直接上傳,這裏是發生了什麼:
iex(2)> Avatar.store("/Users/carlson/Downloads/jupiter.jpg")
{:ok, "jupiter.jpg"}
然而,當我檢查我的S3存儲桶,我只看到幾個老項目。而沒有被添加到本地存儲
CONFIG
文件: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
文件: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鬥政策
{ "Version":"2012-10-17", "Id":"Policy1493266128611", "Statement":[ { "Sid":"Stmt1493266101437", "Effect":"Allow", "Principal":{ "AWS":"*" }, "Action":"s3:GetObject", "Resource":"arn:aws:s3:::noteimages/*" } ] }
您是否從控制檯獲得更多信息?這可能不是問題,但看起來像[config for ex_aws](https://github.com/CargoSense/ex_aws#getting-started)需要成爲'access_key_id'和'secret_access_key'字段的列表。 –