凤凰模块ExAws.S3.Client未加载,无法找到

时间:2016-09-07 06:31:33

标签: amazon-s3 elixir phoenix-framework

我使用了库https://github.com/CargoSense/ex_aws,我遇到了这样的问题:

== Compilation error on file web/models/s3.ex ==
** (CompileError) web/models/s3.ex:2: module ExAws.S3.Client is not loaded and could not be found
    (elixir) expanding macro: Kernel.use/2
    web/models/s3.ex:2: Minion.S3 (module)
    (elixir) lib/kernel/parallel_compiler.ex:116: anonymous fn/4 in Kernel.ParallelCompiler.spawn_compilers/1

在我的mix.exs中:

  def application do
    [mod: {Minion, []},
     applications: [:phoenix, ... :ex_aws, :httpoison, :poison]]
  end
...
  defp deps do
    [{:phoenix, "~> 1.2.1"},
...
     {:ex_aws, "~> 1.0.0-beta0"},
     {:poison, "~> 2.0"},
     {:httpoison, "~> 0.8"}]
  end

我的config.exs:

config :minion, :ex_aws,
  access_key_id: "...",
  secret_access_key: "...",
  region: "us-east-1",
  s3: [
    scheme: "http://",
    host: "...",
    region: "us-east-1"
  ]

我的s3.ex:

defmodule Minion.S3 do
  use ExAws.S3.Client, otp_app: :minion
end

对于解决此问题的任何帮助,我将不胜感激

1 个答案:

答案 0 :(得分:0)

版本> = 1.0.0中的

:ex_aws不使用您需要在模块Minion.S3中执行的旧版(1.0.0版)。这就是ExAws.S3.Client不存在的原因。相反,尝试:

  1. 删除您的文件s3.ex
  2. 在config.exs中,从config :minion, :ex_aws,更改为config :ex_aws,
  3. 将您的请求更新为新样式:S3.list_buckets |> ExAws.request #=> {:ok, response}而不是旧样式Minion.S3.list_buckets