【问题标题】:Phoenix app crashing on Heroku CI凤凰应用程序在 Heroku CI 上崩溃
【发布时间】:2018-04-04 22:51:45
【问题描述】:

我们正在尝试将我们的 CI 从 Travis 移植到 Heroku。测试在本地和 Travis 上都通过了,但在 Heroku 上,我们遇到了一些难以调试的 erlang 错误。

所有错误似乎都来自使用 Elixir Mock 模块同时模拟 AWS S3 请求的测试。

这是一个示例测试:

  test "put_object failure function" do
    with_mock ExAws, [request!: fn(_) -> %{status_code: 500} end] do
      res = S3.put_object("unique.png", "binary")
      assert res == {:error, "error uploading to S3"}
    end
  end

而 put 对象很简单:

  def put_object(unique, image_binary) do
    bucket = System.get_env("BUCKET_NAME")

    res = ExAws.S3.put_object(bucket, unique, image_binary)
    |> ExAws.request!

    case res do
      %{status_code: 200} ->
        {:ok, image_url(unique, bucket)}
      _ ->
        {:error, "error uploading to S3"}
    end
  end

所以我不太确定出了什么问题。

Heroku CI 的错误在这里:

      8) test put_object failure function (Engine.S3Test)
         test/controllers/s3_test.exs:34
         ** (EXIT from #PID<0.1043.0>) 
{:compile_forms, {:error, [{[], [{:none, :compile, {:crash, :lint_module, {:badarg, [{:erlang, :atom_to_list, [[Application]], []}, 
{:erl_lint, :is_latin1_name, 1, [file: 'erl_lint.erl', line: 3050]}, {:erl_lint, :check_module_name, 3, [file: 'erl_lint.erl', line: 3043]}, 
{:erl_lint, :behaviour_callbacks, 3, [file: 'erl_lint.erl', line: 968]}, {:erl_lint, :all_behaviour_callbacks, 3, [file: 'erl_lint.erl', line: 929]}, 
{:erl_lint, :behaviour_check, 2, [file: 'erl_lint.erl', line: 916]}, {:erl_lint, :post_traversal_check, 2, [file: 'erl_lint.erl', line: 888]}, {:erl_lint, :module, 3, [file: 'erl_lint.erl', line: 534]}, {:compile, :lint_module, 2, [file: 'compile.erl', line: 1109]}, {:compile, :"-internal_comp/5-anonymous-1-", 3, [file: 'compile.erl', line: 342]}, {:compile, :fold_comp, 4, [file: 'compile.erl', line: 369]}, {:compile, :internal_comp, 5, [file: 'compile.erl', line: 353]}, 
{:compile, :"-do_compile/2-anonymous-0-", 2, [file: 'compile.erl', line: 177]}, {:compile, :"-do_compile/2-anonymous-1-", 1, [file: 'compile.erl', line: 190]}]}}}]}], []}}

【问题讨论】:

  • 看起来像github.com/jjh42/mock/issues/66。你在使用最新版本的 mock/meck 吗?
  • 那是个好地方!现在会调查它!
  • 这样排序了。将模拟版本更新到 0.3.1 - {:mock, "~&gt; 0.3.1", only: :test} 谢谢@Dogbert

标签: heroku erlang elixir phoenix-framework heroku-ci


【解决方案1】:

感谢@Dogbert 的回答here 对它进行了排序

将模拟版本更新到 0.3.1 - {:mock, "~&gt; 0.3.1", only: :test}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-03-16
    • 2019-05-15
    • 1970-01-01
    • 2019-02-06
    • 2011-10-03
    • 1970-01-01
    相关资源
    最近更新 更多