Elixir Function Succeeding but not Returning Value

I deleted my response by mistake.

You were right, the root problem was the router. I was calling
get("/confirm_email/:token", UserController, :confirm_email) # for json api

and not:

get("/confirm_email/:token", SignupController, :confirm_email)

SignupController:

  def confirm_email(conn, %{"token" => token}) do
    Logger.debug("confirm_email token: #{token}")
    case Accounts.confirm_email!(token) do
      {:ok, updated_user} ->
        conn
        |> Guardian.Plug.sign_in(updated_user)
        |> put_flash(:info, gettext("Welcome %{user_name}!", user_name: updated_user.name))
        |> redirect(to: Routes.page_path(conn, :index))
      {:error, reason} ->
        Logger.debug("error reason: #{reason}")
        json(put_status(conn, 404), %{error: "invalid_token"})
    end
  end

Works fine. Thanks for the help. Guilty of programming while tired.
Leaving this here so others might benefit.

3 Likes