sezaru

sezaru

How to fix Elixir's 1.11 application boundaries?

Elixir’s new version has a new compiler check specified here: link

After upgrading Elixir, now I receive a lot of these compiler warnings, some are related to my project dependencies and are easy to fix, but how do I fix the ones that are triggering because of a dependency of a library that is not mine?

I know that the obvious answer would be a PR (I already submitted some), but still, there is some libraries that are simply dead or very rarely maintained, meaning that even if I send a PR, there is no telling when this PR would be accepted, merged and a new version created.

So, is there any way to at least silence these warnings for a specific library dependency?

Also, how do you handle the case of optional dependencies?

For example, Tesla library has the gun library as an optional dependency: {:gun, "~> 1.3", optional: true},.

Should the library dev still add :gun to its :extra_applications?

If I add :gun to its :extra_applications, it fix the issue, but only if I use :gun dependency in my app, if I don’t use it, I was getting this error: ** (Mix) Could not start application gun: could not find application file: gun.app

Adding :gun to my app (the one that depends on Tesla) to :extra_applications doesn’t seems to affect the warning, I still get it.

So, what is the correct way to handle these warnings?

I would also recommend an official blog post or some documentation on the matter so users not aware of it (specially new users) will not be bombarded by warnings and not know what to do.

Most Liked

josevalim

josevalim

Creator of Elixir

Tesla should pick option 3 in the warning and add xref: [exclude: [:gun, Mint]], since :gun and Mint, etc is optional for them.

Adding :gun to your deps won’t solve it, as this is strictly a problem for when Tesla is compiled.

EDIT: This answer is wrong, please see comments below.

josevalim

josevalim

Creator of Elixir

Good question, you are correct. Mix should be respecting optional deps. The bug is that Tesla is listing :applications explicitly and it does not include gun, mint, etc in the prod environment.

Where Next?

Popular in Questions Top

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
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
mgjohns61585
Could someone help me? I’m making my first elixir program, number guessing game. I can’t figure out how to convert the user’s guess from ...
New
johnnyicon
Hi all, I’ve just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I’m trying to use Postgres...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
lucidguppy
I have a super simple question about elixir - how would I take a file like this foo bar baz and output a new file that enumerates th...
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
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New

Other popular topics Top

hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a > b) do {:ok, "a"} end if (a < b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
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
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 43806 214
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New

We're in Beta

About us Mission Statement