Hi! Trying to upgrade our project to 1.19.3 and OTP 28.1. Having deleted deps and build dirs, reinstalling everything and running mix test, I get the following compilation error
== Compilation error in file test/test.exs ==
** (RuntimeError) Missing dependency: Finch
(exvcr 0.15.2) lib/exvcr/adapter/finch.ex:113: ExVCR.Adapter.Finch.module_name/0
Looking at the code for the ExVCR Finch adaptor, there is this:
if Code.ensure_loaded?(Finch) do
defmodule ExVCR.Adapter.Finch do
<truncated impl for brevity>
end
else
defmodule ExVCR.Adapter.Finch do
def module_name, do: raise("Missing dependency: Finch")
def target_methods, do: raise("Missing dependency: Finch")
end
end
So it seems that during compile time, Finch is not available at all (?) Running Code.ensure_loaded?(Finch) in the test before the above comes into play returns true. I have no idea how to go about this. Any suggestions?
If you are using the Finch adapter, like this:
use ExVCR.Mock, adapter: ExVCR.Adapter.Finch
you have to install finch as a dependency in your project, in mix.exs:
{:finch, "~> 0.18"}
I don’t think your problem is related to elixir/erlang upgrade
It is installed - I can see it in my deps folder. It is also being used by other libs. Lastly, it works fine in 1.18 OTP 27, and starts behaving as soon as I switch to 1.19.
I tried replicating here. I have the exact same error only if I remove Finch dependency, otherwise it works for me. Could you send a minimal example so I can replicate?
I can try replicating in a new project, but I assume it won’t give anything since you tried and didn’t get the same error. I’m more inclined to believe I have made some other mistake in my current project, or missed some detail while upgrading Elixir.
Let me get back to you
@phcurado I actually managed to reproduce it: GitHub - westmark/exvcr_finch_repro Running `mix test` gives me the error. If it doesn’t do the same for you it must be something with my environment.
great! I could replicate the error on your repository. I think the problem might be the exvcr version.
I managed to make it work by changing exvcr version:
{:exvcr, "~> 0.17", only: :test},
And running on the terminal:
mix deps.update exvcr
After this the tests work, maybe it have a bug on old versions of exvcr but I don’t know the cause.
Ah of course. I couldn’t test with the latest as I have a lot of issues with other downstream libs that conflict with each other and I had to make my own temporary version of them. I should have tested 0.17 in my repro.. 
Thanks for helping me out!
1 Like