arpan

arpan

Compilation issues on umbrella project

Hello everyone,

I am currently working on an Elixir project that utilizes an umbrella app setup. Unfortunately, we are encountering numerous compilation issues that are adversely affecting our development experience. I would greatly appreciate your assistance and guidance regarding these challenges.

To provide some context, our umbrella app consists of the following apps:

  • web: Live view user-facing app
  • admin: Live view internal admin app
  • api: GraphQL API app
  • db: DB schemas, changeset, contexts
  • pool: Background jobs, cron jobs, Broadway, etc.

Here is a visual representation of the dependency graph:

Now, let’s delve into the problems we are currently facing:

  1. Lazy Compilation:
    We have observed that when we make code changes, the code only partially compiles. We expected that running mix compile followed by starting the server would eliminate the need for further compilation. However, we are encountering situations where the code starts compiling again after the server is launched or upon hitting certain code paths, such as specific browser URLs.

  2. Mismatch in Compile-time vs. Runtime Value Configuration:
    During server startup, we often encounter errors indicating a mismatch between the compile-time and runtime values of certain configurations. For example:

    ERROR! the application :db has a different value set for key :default_admin_id during runtime compared to compile time. Since this application environment entry was marked as compile time, this difference can lead to different behaviour than expected:
    
    * Compile time value was set to: nil
    * Runtime value was set to: "xxxx"
    

    The environment variable is correctly sourced in the terminal and available during compilation. This error typically occurs when restarting the server process within the same terminal. The only workaround we have found is to kill the server process and execute mix compile --force.

  3. Nebulex:
    We are utilizing Nebulex for caching purposes, but we frequently encounter the following error:

    (Nebulex.RegistryLookupError) could not lookup Nebulex cache App.API.Cache.UserCache because it was not started or it does not exist
    

    This issue often arises when code changes trigger recompilation while the server is running or when manually recompiling in the iex session. The only solution we have found is to restart the server.

  4. Unfinished Compilation:
    When making code changes, we often encounter errors due to the code attempting to access modules that are still in the process of compilation. For instance, the web app may attempt to access a module in the db app that is still compiling, leading to errors. This becomes more problematic due to live reloading in Phoenix.
    We expect the app to wait until all related modules and umbrella dependencies have finished compiling before attempting to load a page. Additionally, we feel that there are unnecessary compilations of unrelated components even for minor code changes, resulting in slower development cycles.

I would greatly appreciate any help, suggestions, or insights regarding these issues.

Where Next?

Popular in Questions Top

vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

Other popular topics Top

nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New

We're in Beta

About us Mission Statement