realtime icon indicating copy to clipboard operation
realtime copied to clipboard

Startup error running migrations: table identifier does not refer to an existing ETS table

Open chetan opened this issue 1 year ago • 11 comments

Bug report

Migrations fail to run properly. Appears to be due to the use of Mix.env() introduced in #736.

supabase-realtime  | Setting RLIMIT_NOFILE to 100000
supabase-realtime  | 13:58:43.351 [info] Migrations already up
supabase-realtime  | ** (ArgumentError) errors were found at the given arguments:
supabase-realtime  |
supabase-realtime  |   * 1st argument: the table identifier does not refer to an existing ETS table
supabase-realtime  |
supabase-realtime  |     (stdlib 4.3) :ets.lookup(Mix.State, :env)
supabase-realtime  |     lib/mix/state.ex:31: Mix.State.get/2
supabase-realtime  |     /app/lib/realtime-2.25.32/priv/repo/seeds.exs:5: (file)
supabase-realtime  |     nofile:1: (file)
supabase-realtime  |     (stdlib 4.3) erl_eval.erl:748: :erl_eval.do_apply/7
supabase-realtime  |     (stdlib 4.3) erl_eval.erl:492: :erl_eval.expr/6
supabase-realtime  |     (stdlib 4.3) erl_eval.erl:136: :erl_eval.exprs/6
supabase-realtime  | erl_child_setup: failed with error 32 on line 281

I took a look at fixing this but don't know elixir at all. According to the docs, Mix.env() shouldn't be used in production code (i.e., outside the build system), but I do see it being used in other places in the codebase. Not sure why it's throwing here and not elsewhere.

To Reproduce

Run the latest realtime image supabase/realtime:v2.25.32 on an existing instance (likely throws on fresh data as well)

chetan avatar Nov 16 '23 14:11 chetan

/cc: @filipecabaco

chetan avatar Nov 16 '23 14:11 chetan

opening PR 👀 thank you again for flagging this issues

filipecabaco avatar Nov 16 '23 14:11 filipecabaco

@chetan where are you running the image? supabase docker compose or cli?

filipecabaco avatar Nov 16 '23 15:11 filipecabaco

ok was able to replicate in the supabase/docker 👍 will test the fix

filipecabaco avatar Nov 16 '23 16:11 filipecabaco

https://github.com/supabase/realtime/pull/739

filipecabaco avatar Nov 16 '23 16:11 filipecabaco

Merged 🎉

filipecabaco avatar Nov 16 '23 16:11 filipecabaco

Verified!

chetan avatar Nov 16 '23 19:11 chetan

thank you so much for reporting and patience 🙏

filipecabaco avatar Nov 16 '23 19:11 filipecabaco

still encountering this on CLI version 1.165.0 and realtime v2.28.32

Silur avatar May 07 '24 10:05 Silur

still present on CLI 1.176.10 and realtime v2.28.32

Silur avatar Jun 16 '24 09:06 Silur

@Silur could you share the command and logs so I can try to replicate it?

filipecabaco avatar Jun 17 '24 21:06 filipecabaco