zac
Ash / Phoenix deps update results in /sign-in error: Cannot set assign `current_members` before default `AshAuthentication.Phoenix.LiveSession.on_mount/4` has run
I just ran a relatively minor deps update on my Ash / Ash Auth / Phoenix project:
Upgraded:
ash 3.5.32 => 3.5.36
ash_authentication 4.9.8 => 4.9.9
ash_authentication_phoenix 2.10.4 => 2.10.5
ash_phoenix 2.3.11 => 2.3.14
ash_postgres 2.6.13 => 2.6.16
ash_sql 0.2.89 => 0.2.90
bandit 1.7.0 => 1.8.0
castore 1.0.14 => 1.0.15
cc_precompiler 0.1.10 => 0.1.11
fine 0.1.1 => 0.1.4
igniter 0.6.25 => 0.6.28
lazy_html 0.1.3 => 0.1.6
phoenix 1.8.0-rc.4 => 1.8.0
phoenix_live_view 1.1.0-rc.4 => 1.1.8
postgrex 0.20.0 => 0.21.1 (minor)
spark 2.2.67 => 2.2.68
thousand_island 1.3.14 => 1.4.0
Probably the most notable was Phoenix Live View 1.1.0-rc4 → 1.1.8 (eek, not sure why that was stuck back there). Pretty minor Ash deps upgrade…
And now when I hit /sign-in (or, any other page that requires an authenticated user) I’m getting this:
[error] ** (RuntimeError) Cannot set assign `current_members` before default `AshAuthentication.Phoenix.LiveSession.on_mount/4` has run.
(ash_authentication_phoenix 2.10.5) lib/ash_authentication_phoenix/live_session.ex:174: anonymous fn/5 in AshAuthentication.Phoenix.LiveSession.on_mount/4
(elixir 1.18.4) lib/enum.ex:4515: anonymous fn/3 in Enum.reduce/3
(elixir 1.18.4) lib/stream.ex:1761: anonymous fn/3 in Enumerable.Stream.reduce/3
(elixir 1.18.4) lib/enum.ex:4968: Enumerable.List.reduce/3
(elixir 1.18.4) lib/stream.ex:1773: Enumerable.Stream.do_each/4
(elixir 1.18.4) lib/enum.ex:4515: Enum.reduce/3
(ash_authentication_phoenix 2.10.5) lib/ash_authentication_phoenix/live_session.ex:170: AshAuthentication.Phoenix.LiveSession.on_mount/4
(phoenix_live_view 1.1.8) lib/phoenix_live_view/lifecycle.ex:158: anonymous fn/4 in Phoenix.LiveView.Lifecycle.mount/3
(phoenix_live_view 1.1.8) lib/phoenix_live_view/lifecycle.ex:237: Phoenix.LiveView.Lifecycle.reduce_socket/3
(phoenix_live_view 1.1.8) lib/phoenix_live_view/utils.ex:346: anonymous fn/6 in Phoenix.LiveView.Utils.maybe_call_live_view_mount!/5
(telemetry 1.3.0) /Users/zac/Projects/BossLogic/waste_walk/deps/telemetry/src/telemetry.erl:324: :telemetry.span/3
(phoenix_live_view 1.1.8) lib/phoenix_live_view/static.ex:324: Phoenix.LiveView.Static.call_mount_and_handle_params!/5
(phoenix_live_view 1.1.8) lib/phoenix_live_view/static.ex:155: Phoenix.LiveView.Static.do_render/4
(phoenix_live_view 1.1.8) lib/phoenix_live_view/controller.ex:39: Phoenix.LiveView.Controller.live_render/3
(phoenix 1.8.0) lib/phoenix/router.ex:416: Phoenix.Router.__call__/5
(waste_walk 0.1.0) lib/waste_walk_web/endpoint.ex:1: WasteWalkWeb.Endpoint.plug_builder_call/2
(waste_walk 0.1.0) deps/plug/lib/plug/debugger.ex:155: WasteWalkWeb.Endpoint."call (overridable 3)"/2
(waste_walk 0.1.0) lib/waste_walk_web/endpoint.ex:1: WasteWalkWeb.Endpoint.call/2
(phoenix 1.8.0) lib/phoenix/endpoint/sync_code_reload_plug.ex:22: Phoenix.Endpoint.SyncCodeReloadPlug.do_call/4
(bandit 1.8.0) lib/bandit/pipeline.ex:131: Bandit.Pipeline.call_plug!/2
Which is kind of a black-box thing to break. Any ideas how I can diagnose and fix it?
I’m suspecting that perhaps my Ash Authentication original config is somehow out of date (maybe run a new igniter project, compare the results)… or… kinda at a loss.
//Edit
Well, generated a parallel project with latest libs. I don’t see any obvious differences between the new and the old, looked at all the config files, things like live_user_auth.ex etc., I don’t see any significant delta. Really weird.
Marked As Solved
zachdaniel
Last Post!
zachdaniel
It being on two resources is actually one of the first issues I asked about
. The plug for setting the actor uses the “subject name” to assign to the socket or the conn, i.e “current_members”. It ensures that the assign is always present but nil if no token was given. We should provide a better error there naturally, but in this case the second pass failed thinking someone had touched its assign and was trying to warn you not to mess with it.
Popular in Questions
Other popular topics
Latest Ash Threads
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #hex
- #security









