Upgrading to Bamboo 2.2.0 from 1.6.0 Results in `Bamboo.Phoenix is not loaded and could not be found`

The line looks like:
use Bamboo.Phoenix, view: FaithfulWordWeb.EmailView

and it’s like Bamboo.Phoenix is just gone now:

== Compilation error in file lib/faithful_word/emails.ex ==
** (CompileError) lib/faithful_word/emails.ex:3: module Bamboo.Phoenix is not loaded and could not be found
    (elixir 1.11.1) expanding macro: Kernel.use/2
    lib/faithful_word/emails.ex:3: FaithfulWord.Emails (module)
    (elixir 1.11.1) lib/kernel/parallel_compiler.ex:314: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/7

I like having Bamboo.Phoenix because I can assign() using pipe operator like:

  def welcome_email(%{email: email, org_name: org_name, url: url}) do
    base_email()
    |> IO.inspect()
    |> subject("#{org_name} - Welcome!")
    |> to(email)
    |> assign(:email, email)
    |> assign(:org_name, org_name)
    |> assign(:url, url)
    |> render_i18n(:welcome_email)
    |> premail()
    |> FaithfulWord.Mailer.deliver_now()

    :ok
  end

Rolling back to 1.7(or 1.6) and compile is OK.

You need to follow the process outlined in Upgrading to Bamboo 2.0.

3 Likes

Whoops, sorry I didn’t see that. I’m all good now with that other dependency.

1 Like