I’m working on a Phoenix application that uses the FunWithFlags library. The problem is that after each deployment for a brief amount of time, some requests will fail to complete due to the following error:
* 1st argument: the table identifier does not refer to an existing ETS table
(stdlib 6.0) :ets.lookup(:fun_with_flags_cache, :my_flag_example)
(fun_with_flags 1.12.0) lib/fun_with_flags/store/cache.ex:49: FunWithFlags.Store.Cache.get/1
(fun_with_flags 1.12.0) lib/fun_with_flags/store.ex:12: FunWithFlags.Store.lookup/1
lib/fun_with_flags.ex:86: FunWithFlags.enabled?/2
This error happens in various places: sometimes in plugs used in our routes, other times in jobs that will be running while the deployment is happening. We are using AWS and rolling updates. The error appears when a new instance goes up and the FunWithFlags table is not set in ETS, but I’m not sure how to fix it. I followed the instructions in the library to make the initialization inside the application GitHub - tompave/fun_with_flags: Feature Flags/Toggles for Elixir
Here’s the code in the app for the initialization of the library:
application.ex
children = [
...
FunWithFlags.Supervisor,
...
]
Supervisor.start_link(children, opts)
def project do
[
app: :my_app,
version: "0.1.0",
elixir: "~> 1.17",
elixirc_paths: elixirc_paths(Mix.env()),
compilers: Mix.compilers(),
start_permanent: Mix.env() == :prod,
aliases: aliases(),
deps: deps(),
releases: [
my_app: [
applications: [
fun_with_flags: :load,
fun_with_flags_ui: :load
]
]
]
]
end
defp deps do
[
...
{:fun_with_flags, "~> 1.12", runtime: false},
{:fun_with_flags_ui, "~> 1.0", runtime: false},
...
end
]
I would expect more people to have run into this problem but I searched in the forum and the library issue and didn’t find anything related to it. Thanks in advance