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
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

vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
Werner
Hi, I’m using Ubuntu 18.04 and after updating to OTP-24.0 yesterday i have this warning when I run “mix local.hex”: 14:57:30.512 [warn] ...
New
logicmason
Hi there, I'm working through my first release with elixir/phoenix. I've built a release with distillery and found that it crashes when I...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
gonzofish
I’m currently trying to understand how to join three tables using Ecto. All the examples I’ve seen use 2, so maybe I’m just missing somet...
New
beno
I will often find my self writing things similar to: case some_value do nil -> something() "" -> something() _ -> someth...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers' Functional Web Development with Elixir, OTP, and Phoenix forum. ...
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

Other popular topics Top

sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
977 41022 311
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
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
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set? Thanks.
New
fireproofsocks
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list....
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.h...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
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

We're in Beta

About us Mission Statement