Closed mustela closed 4 years ago
Hi, thank you for trying the library and for reporting this issue.
It looks like the package thinks that it's configured to use Redis.
Maybe it's because of this: https://github.com/tompave/fun_with_flags#configuration-changes-have-no-effect-in-mix_envdev
Can you try to run rm -r _build/dev/lib/fun_with_flags
and see if it solves the issue?
No, that didn't work, and there are a lot of warnings in there:
==> fun_with_flags
Compiling 20 files (.ex)
warning: function EventsApi.Repo.__adapter__/0 is undefined (module EventsApi.Repo is not available)
lib/fun_with_flags/store/persistent/ecto.ex:268
warning: function EventsApi.Repo.all/1 is undefined (module EventsApi.Repo is not available)
Found at 3 locations:
lib/fun_with_flags/store/persistent/ecto.ex:31
lib/fun_with_flags/store/persistent/ecto.ex:201
lib/fun_with_flags/store/persistent/ecto.ex:211
warning: function EventsApi.Repo.delete_all/1 is undefined (module EventsApi.Repo is not available)
Found at 3 locations:
lib/fun_with_flags/store/persistent/ecto.ex:136
lib/fun_with_flags/store/persistent/ecto.ex:163
lib/fun_with_flags/store/persistent/ecto.ex:188
warning: function EventsApi.Repo.insert/2 is undefined (module EventsApi.Repo is not available)
lib/fun_with_flags/store/persistent/ecto.ex:279
warning: function EventsApi.Repo.one/1 is undefined (module EventsApi.Repo is not available)
lib/fun_with_flags/store/persistent/ecto.ex:57
warning: function EventsApi.Repo.rollback/1 is undefined (module EventsApi.Repo is not available)
Found at 3 locations:
lib/fun_with_flags/store/persistent/ecto.ex:105
lib/fun_with_flags/store/persistent/ecto.ex:108
lib/fun_with_flags/store/persistent/ecto.ex:118
warning: function EventsApi.Repo.transaction/1 is undefined (module EventsApi.Repo is not available)
Found at 2 locations:
lib/fun_with_flags/store/persistent/ecto.ex:92
lib/fun_with_flags/store/persistent/ecto.ex:99
warning: function EventsApi.Repo.update/2 is undefined (module EventsApi.Repo is not available)
lib/fun_with_flags/store/persistent/ecto.ex:286
Generated fun_with_flags app
==> events_api
Compiling 187 files (.ex)
Generated events_api app
[error] FunWithFlags: It looks like you're trying to use FunWithFlags.Notifications.Redis for the cache-busting notifications, but you haven't added its optional dependency to the Mixfile of your project. If you don't need cache-busting notifications, they can be disabled to make this error go away.
[info] Application fun_with_flags exited: exited in: FunWithFlags.Application.start(:normal, [])
** (EXIT) an exception was raised:
** (UndefinedFunctionError) function FunWithFlags.Notifications.Redis.worker_spec/0 is undefined (module FunWithFlags.Notifications.Redis is not available)
FunWithFlags.Notifications.Redis.worker_spec()
(fun_with_flags) lib/fun_with_flags/application.ex:45: FunWithFlags.Application.notifications_spec/0
(fun_with_flags) lib/fun_with_flags/application.ex:18: FunWithFlags.Application.children/0
(fun_with_flags) lib/fun_with_flags/application.ex:10: FunWithFlags.Application.start/2
(kernel) application_master.erl:277: :application_master.start_it_old/4
** (Mix) Could not start application fun_with_flags: exited in: FunWithFlags.Application.start(:normal, [])
** (EXIT) an exception was raised:
** (UndefinedFunctionError) function FunWithFlags.Notifications.Redis.worker_spec/0 is undefined (module FunWithFlags.Notifications.Redis is not available)
FunWithFlags.Notifications.Redis.worker_spec()
(fun_with_flags) lib/fun_with_flags/application.ex:45: FunWithFlags.Application.notifications_spec/0
(fun_with_flags) lib/fun_with_flags/application.ex:18: FunWithFlags.Application.children/0
(fun_with_flags) lib/fun_with_flags/application.ex:10: FunWithFlags.Application.start/2
(kernel) application_master.erl:277: :application_master.start_it_old/4
there are a lot of warnings in there:
All the module EventsApi.Repo is not available
are unfortunately expected. It's because FunWithFlags is compiled before your application, and so it's referring to your Ecto repo module that is not available at that time yet. Normally they can be ignored.
It's odd that you're still getting that error even though the FWF app is clearly being compiled with an ecto repo.
By any chance, have you got different FWF configuration in your config/config.exs
and config/dev.exs
?
As a test, try the following:
redix
as a dependency, just to make the application start.iex -S mix
invoke these two functions, and post here the return values.FunWithFlags.Config.persistence_adapter()
FunWithFlags.Store.Persistent.adapter()
The config.exs
is the only file where I have the settings.
I add redix and this is what I have
Interactive Elixir (1.9.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> FunWithFlags.Config.persistence_adapter()
FunWithFlags.Store.Persistent.Ecto
iex(2)> FunWithFlags.Store.Persistent.adapter()
FunWithFlags.Store.Persistent.Ecto
Then that shouldn't happen. Can you please prepare a repo with a sample application where the issue can be replicated?
I just created a repo here https://github.com/mustela/test_feature and is having the same issue:
iex -S mix phx.server
Erlang/OTP 22 [erts-10.4.4] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [hipe] [dtrace]
[error] FunWithFlags: It looks like you're trying to use FunWithFlags.Store.Persistent.Redis to persist flags, but you haven't added its optional dependency to the Mixfile of your project.
[info] Application fun_with_flags exited: exited in: FunWithFlags.Application.start(:normal, [])
** (EXIT) an exception was raised:
** (UndefinedFunctionError) function FunWithFlags.Store.Persistent.Redis.worker_spec/0 is undefined (module FunWithFlags.Store.Persistent.Redis is not available)
FunWithFlags.Store.Persistent.Redis.worker_spec()
(fun_with_flags 1.4.1) lib/fun_with_flags/application.ex:28: FunWithFlags.Application.persistence_spec/0
(fun_with_flags 1.4.1) lib/fun_with_flags/application.ex:17: FunWithFlags.Application.children/0
(fun_with_flags 1.4.1) lib/fun_with_flags/application.ex:10: FunWithFlags.Application.start/2
(kernel 6.4.1) application_master.erl:277: :application_master.start_it_old/4
** (Mix) Could not start application fun_with_flags: exited in: FunWithFlags.Application.start(:normal, [])
** (EXIT) an exception was raised:
** (UndefinedFunctionError) function FunWithFlags.Store.Persistent.Redis.worker_spec/0 is undefined (module FunWithFlags.Store.Persistent.Redis is not available)
FunWithFlags.Store.Persistent.Redis.worker_spec()
(fun_with_flags 1.4.1) lib/fun_with_flags/application.ex:28: FunWithFlags.Application.persistence_spec/0
(fun_with_flags 1.4.1) lib/fun_with_flags/application.ex:17: FunWithFlags.Application.children/0
(fun_with_flags 1.4.1) lib/fun_with_flags/application.ex:10: FunWithFlags.Application.start/2
(kernel 6.4.1) application_master.erl:277: :application_master.start_it_old/4
I've tried to run your example app, and I'm not getting that error.
I'm getting the expected similar error for the notifications adapter.
[error] FunWithFlags: It looks like you're trying to use FunWithFlags.Notifications.Redis for the cache-busting notifications, but you haven't added its optional dependency to the Mixfile of your project. If you don't need cache-busting notifications, they can be disabled to make this error go away.
I say that's expected because the cache-bushing notifications are not configured, and they default to using the Redis adapter. It can be easily fixed with:
config :fun_with_flags, :cache_bust_notifications,
enabled: true,
adapter: FunWithFlags.Notifications.PhoenixPubSub,
client: TestFeature.PubSub
Or:
config :fun_with_flags, :cache_bust_notifications, enabled: false
After that, the sample app fails because of some missing config and remote dependencies for the rollbax
and goth
packages. If I disable those two, and create the Postgres DB, it works.
Not sure what happened here, but after adding config :fun_with_flags, :cache_bust_notifications,....
it worked.
Thanks a lot for spending time on it!! <3
Hey there!
Im trying to use the lib but it seems that I can't make it work with the basic configuration.
In my
config.exs
I have:I do have in my mix file
Elixir version:
I haven't found anything else in the docs that need to be changed. What am I doing wrong?
Thanks