Git Product home page Git Product logo

Comments (4)

lpender avatar lpender commented on May 28, 2024 1

Update:

The solution for this is to move the factory.ex file from lib/my_app/factory.ex to test/support/factory.ex.

I see now that the README says to do this now.

I was confused because I was following constable.

We can leave this closed, just posting for future generations.

from ex_machina.

germsvel avatar germsvel commented on May 28, 2024

Hi @lpender, thanks for opening this issue. I am unable to reproduce the error the way you've defined it. Could you provide some more information on how to reproduce it? What does your factory.ex module look like?

from ex_machina.

germsvel avatar germsvel commented on May 28, 2024

@lpender I'm gonna close this issue since I imagine you got it resolved. But if I'm mistaken, please feel free to comment here and we can reopen it.

from ex_machina.

lpender avatar lpender commented on May 28, 2024

Hi,

Thanks,

I'm using the Dockerfile described in the Phoenix Documentation.

Notably, because Mix is a build tool, many things fail with this setup, i.e. any calls to Mix.env() in runtime code (which I see for example, in the default router.ex generated by Phoenix and in constable).

This is puzzling to me, but I digress.

I'm still running into this issue.

# mix.exs
  defp deps do
      {:ex_machina, "~> 2.4", only: :test}
  end
# lib/risc/factory.ex

defmodule Risc.Factory do
  use ExMachina.Ecto, repo: Risc.Repo

  def account_factory do
    %Risc.Accounts.Account{
      email: sequence(:email, &"email-#{&1}@example.com"),
      password: "sooperdoopersecret"
    }
  end
end

Docker Compilation:

Step 17/25 : RUN mix do compile, release
 ---> Running in c6748e8c0dd3
Compiling 34 files (.ex)
== Compilation error in file lib/risc/factory.ex ==
** (CompileError) lib/risc/factory.ex:2: module ExMachina.Ecto is not loaded and could not be found
    (elixir) expanding macro: Kernel.use/2
    lib/risc/factory.ex:2: Risc.Factory (module)

This error doesn't happen if I remove the only: :test but that causes the mix compile,release command to fail with a different error:

Cannot read "/app/_build/prod/rel/my_app/releases/0.1.0/start.script

from ex_machina.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.