Module is not available - Phoenix Umbrella app

This is the first time I’ve ever experienced this, it’s extremely odd.

I iex -S mix in my console and am trying to call a module and function. But I get this error:

iex(1)> Example.RecipeQueries.get_all
** (UndefinedFunctionError) function Example.RecipeQueries.get_all/0 is undefined (module Example.RecipeQueries is not available)
    Example.RecipeQueries.get_all()

iex(1)> Example.
Application    Mixfile        Repo           hello/0

I’ve never had this problem before. I deleted _build folder in the root umbrella folder and it still doesn’t work.

The module is declared in ~/umbrella/apps/recipes_api/recipes/recipe_queries.ex

defmodule Example.RecipeQueries do
  def get_all do
    Repo.all(from Recipes)
  end
end

What do I look for to fix this bug?

@sergio Unless you’ve modified recipe_api's elixirc_paths config to autoload the recipes folder, you’ll want to move recipes in to lib.

Elixir applications don’t automatically load up everything, only some sane defaults, including the lib folder.

2 Likes