tompave / fun_with_flags_ui

Web dashboard for the FunWithFlags Elixir package
MIT License
128 stars 29 forks source link

(UndefinedFunctionError) function FunWithFlags.Store.Persistent.Redis.all_flags/0 is undefined (module FunWithFlags.Store.Persistent.Redis is not available) #21

Closed ghost closed 2 years ago

ghost commented 2 years ago

Getting

Request: GET /feature-flags/flags
** (exit) an exception was raised:
    ** (UndefinedFunctionError) function FunWithFlags.Store.Persistent.Redis.all_flags/0 is undefined (module FunWithFlags.Store.Persistent.Redis is not available)
        FunWithFlags.Store.Persistent.Redis.all_flags()
        (fun_with_flags_ui 0.7.2) lib/fun_with_flags/ui/router.ex:73: anonymous fn/2 in FunWithFlags.UI.Router.do_match/4
        (fun_with_flags_ui 0.7.2) lib/plug/router.ex:280: anonymous fn/4 in FunWithFlags.UI.Router.dispatch/2
        (telemetry 0.4.3) /Users/q/Developer/app/deps/telemetry/src/telemetry.erl:272: :telemetry.span/3
        (fun_with_flags_ui 0.7.2) lib/plug/router.ex:276: FunWithFlags.UI.Router.dispatch/2
        (fun_with_flags_ui 0.7.2) lib/fun_with_flags/ui/router.ex:1: FunWithFlags.UI.Router.plug_builder_call/2
        (phoenix 1.5.13) lib/phoenix/router/route.ex:41: Phoenix.Router.Route.call/2
        (phoenix 1.5.13) lib/phoenix/router.ex:352: Phoenix.Router.__call__/2

for an app setup like this:

config :fun_with_flags, :persistence,
  adapter: FunWithFlags.Store.Persistent.Ecto,
  repo: App.Repo,
  ecto_table_name: "fun_with_flags_toggles"

config :fun_with_flags, :cache_bust_notifications, enabled: false
  pipeline :admins_only do
    plug :basic_auth, Application.compile_env(:app, :basic_auth)
  end

  scope path: "/feature-flags" do
    pipe_through [:mounted_apps, :admins_only]
    forward "/", FunWithFlags.UI.Router, namespace: "feature-flags"
  end
%{
  "fun_with_flags": {:hex, :fun_with_flags, "1.6.0", "507fcbc19374e83d34ba13d63b0816d37af952da1c6592978bbf40dad6a2e671", [:mix], [{:ecto_sql, "~> 3.0", [hex: :ecto_sql, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: true]}, {:redix, "~> 1.0", [hex: :redix, repo: "hexpm", optional: true]}], "hexpm", "96b53f54737906c5a83b5d89922ca1145fda2d50db23b1f619478460b8d5f8d8"},
  "fun_with_flags_ui": {:hex, :fun_with_flags_ui, "0.7.2", "c8df9e90f92481c014824ab1ff5db7d501ac34ec28a4599b76251ec5a6db0861", [:mix], [{:cowboy, ">= 1.0.0", [hex: :cowboy, repo: "hexpm", optional: true]}, {:fun_with_flags, "~> 1.1", [hex: :fun_with_flags, repo: "hexpm", optional: false]}, {:plug, "~> 1.4", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, ">= 1.0.0", [hex: :plug_cowboy, repo: "hexpm", optional: true]}], "hexpm", "99b3635b067304722560ea3d5aab38ae23ea1217366c95ecb6263559488a22f2"},
}
tompave commented 2 years ago

This has been discussed a few times on the fun_with_flags repo. It's happening because you've changed your config without recompiling the dependency. Try with the latest version.

ghost commented 2 years ago

It's happening because you've changed your config without recompiling the dependency.

I haven't, it's happening in a fresh install right after compilation.


For reference:

iex(3)> Application.get_all_env(:fun_with_flags)
[
  persistence: [
    adapter: FunWithFlags.Store.Persistent.Ecto,
    repo: App.Repo,
    ecto_table_name: "fun_with_flags_toggles"
  ],
  cache_bust_notifications: [
    enabled: false
  ]
]
iex(4)> Application.get_all_env(:fun_with_flags)[:persistence]
[
  adapter: FunWithFlags.Store.Persistent.Ecto,
  repo: App.Repo,
  ecto_table_name: "fun_with_flags_toggles"
]
ghost commented 2 years ago

Related issue: https://github.com/tompave/fun_with_flags/issues/109

tompave commented 2 years ago

I haven't, it's happening in a fresh install right after compilation.

It seems unlikely. Have you tried this? https://github.com/tompave/fun_with_flags/tree/v1.6.0#configuration-changes-have-no-effect-in-mix_envdev

And, have you tried the latest version of fun with flags?