stavro/arc_ecto

Issue when using exrm

Closed this issue · 4 comments

Hello,

I have trouble with arc_ecto when using it with exrm release.
I have test the development version everything work fine.
It's seems like arc_ecto and ecto didn't get included in the release.
Could you recommend where should I look to fix any issues.

The error that I get is as follows -

02:56:13.493 request_id=pb76qtumnk6u9p7irjoketfv25p24tb9 [info] Sent 500 in 51ms 
02:56:13.508 [error] #PID<0.270.0> running Warehouse.Endpoint terminated
Server: warehouse.csweb.in.th:80 (http)
Request: POST /manage/companies/1/import
** (exit) an exception was raised:
    ** (UndefinedFunctionError) undefined function Arc.Ecto.Model.convert_params_to_binary/1 (module Arc.Ecto.Model is not available)
        Arc.Ecto.Model.convert_params_to_binary(%{"import" => %Plug.Upload{content_type: "application/pdf", filename: "application_form_original.th.kamolthip.pdf", path: "/tmp/plug-1455/multipart-72973-462679-1"}})

my mix.exs look like this

defmodule Warehouse.Mixfile do
  use Mix.Project

  def project do
    [app: :warehouse,
     version: "0.0.6",
     elixir: "~> 1.0",
     elixirc_paths: elixirc_paths(Mix.env),
     compilers: [:phoenix, :gettext] ++ Mix.compilers,
     build_embedded: Mix.env == :prod,
     start_permanent: Mix.env == :prod,
     aliases: aliases,
     deps: deps]
  end

  # Configuration for the OTP application.
  #
  # Type `mix help compile.app` for more information.
  def application do
    [mod: {Warehouse, []},
     applications: [:phoenix, :phoenix_html, :cowboy, :logger, :gettext,
                    :phoenix_ecto, :postgrex, :comeonin]]
  end

  # Specifies which paths to compile per environment.
  defp elixirc_paths(:test), do: ["lib", "web", "test/support"]
  defp elixirc_paths(_),     do: ["lib", "web"]

  # Specifies your project dependencies.
  #
  # Type `mix help deps` for examples and options.
  defp deps do
    [{:phoenix, "~> 1.1.2"},
     {:phoenix_ecto, "~> 2.0"},
     {:postgrex, ">= 0.0.0"},
     {:phoenix_html, "~> 2.3"},
     {:phoenix_live_reload, "~> 1.0", only: :dev},
     {:gettext, "~> 0.9"},
     {:comeonin, "~> 2.1"},
     {:arc_ecto, "~> 0.3.1"},
     {:exrm, "~> 0.19.9"},
     {:cowboy, "~> 1.0"}]
  end

  # Aliases are shortcut or tasks specific to the current project.
  # For example, to create, migrate and run the seeds file at once:
  #
  #     $ mix ecto.setup
  #
  # See the documentation for `Mix` for more info on aliases.
  defp aliases do
    ["ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"],
     "ecto.reset": ["ecto.drop", "ecto.setup"]]
  end
end

my mix.lock looks like this

%{"arc": {:hex, :arc, "0.2.3"},
  "arc_ecto": {:hex, :arc_ecto, "0.3.1"},
  "bbmustache": {:hex, :bbmustache, "1.0.3"},
  "comeonin": {:hex, :comeonin, "2.1.0"},
  "conform": {:hex, :conform, "0.17.0"},
  "connection": {:hex, :connection, "1.0.2"},
  "cowboy": {:hex, :cowboy, "1.0.4"},
  "cowlib": {:hex, :cowlib, "1.0.2"},
  "db_connection": {:hex, :db_connection, "0.2.1"},
  "decimal": {:hex, :decimal, "1.1.1"},
  "ecto": {:hex, :ecto, "1.1.3"},
  "erlware_commons": {:hex, :erlware_commons, "0.15.0"},
  "exrm": {:hex, :exrm, "0.19.9"},
  "fs": {:hex, :fs, "0.9.2"},
  "getopt": {:hex, :getopt, "0.8.2"},
  "gettext": {:hex, :gettext, "0.9.0"},
  "neotoma": {:hex, :neotoma, "1.7.3"},
  "phoenix": {:hex, :phoenix, "1.1.4"},
  "phoenix_ecto": {:hex, :phoenix_ecto, "2.0.1"},
  "phoenix_html": {:hex, :phoenix_html, "2.4.0"},
  "phoenix_live_reload": {:hex, :phoenix_live_reload, "1.0.3"},
  "plug": {:hex, :plug, "1.1.0"},
  "poison": {:hex, :poison, "1.5.2"},
  "poolboy": {:hex, :poolboy, "1.5.1"},
  "postgrex": {:hex, :postgrex, "0.11.0"},
  "providers": {:hex, :providers, "1.4.1"},
  "ranch": {:hex, :ranch, "1.2.1"},
  "relx": {:hex, :relx, "3.5.0"}}

Thank you for your help.

I haven't used releases yet, but I plan on soon, so we should fix this.

What happens if you add arc and arc_ecto to the applications list in mix.exs?

By adding both arc_ecto and arc to applications list, it is working now
Thank you very much @stavro

So I get this still with

  def application do
    [mod: {Scotchy, []},
     applications: [:phoenix, :phoenix_pubsub, :phoenix_html, :cowboy, :logger, :gettext,
                :phoenix_ecto, :postgrex, :timex, :arc, :arc_ecto, :exseed]]
  end

and the error

Request: GET /bottles/new
** (exit) an exception was raised:
    ** (UndefinedFunctionError) function Arc.Ecto.Model.convert_params_to_binary/1 is undefined (module Arc.Ecto.Model is not available)

and my deps

  defp deps do
    [{:phoenix, "~> 1.2.0"},
     {:postgrex, ">= 0.0.0"},
     {:phoenix_pubsub, "~> 1.0"},
     {:phoenix_ecto, "~> 3.0-rc"},
     {:phoenix_html, "~> 2.4"},
     {:arc, "~> 0.5.1"},
     {:arc_ecto, "~> 0.3.2",},
     {:phoenix_live_reload, "~> 1.0", only: :dev},
     {:gettext, "~> 0.9"},
     {:exseed, "~> 0.0.3"},
     {:phoenix_generator, github: "etufe/phoenix_generator", only: :dev},
     {:exrm, "~> 1.0.0"},
     {:cowboy, "~> 1.0"},
     {:timex, "1.0.2"}]
  end

Nevermind, i was clearly still on .3.2 and need to update to Arc.Ecto.Schema