Key :editing_tenant not found
Just starting to explore AshAdmin.
I'm not sure how AshAdmin interacts with multitenancy. For context, some of my apis are multitenancy but not all of them. The tenant for web is via a url slug. For graphql, it's a header. When admin starts, I'm assuming there won't be a tenant.
** (KeyError) key :editing_tenant not found in: %{
__changed__: %{
clear_tenant: true,
flash: true,
id: true,
set_tenant: true,
tenant: true
},
__given__: %{
__changed__: %{
clear_tenant: true,
flash: true,
id: true,
set_tenant: true,
tenant: true
},
clear_tenant: "clear_tenant",
flash: %{},
id: "tenant_editor",
myself: %Phoenix.LiveComponent.CID{cid: 7},
set_tenant: "set_tenant",
socket: #Phoenix.LiveView.Socket<
id: "phx-F3YXwxGfYHWbADEG",
endpoint: KickplanWeb.Endpoint,
view: AshAdmin.PageLive,
parent_pid: nil,
root_pid: nil,
router: KickplanWeb.Router,
assigns: #Phoenix.LiveView.Socket.AssignsNotInSocket<>,
transport_pid: nil,
...
>,
tenant: nil
},
clear_tenant: "clear_tenant",
flash: %{},
id: "tenant_editor",
myself: %Phoenix.LiveComponent.CID{cid: 7},
set_tenant: "set_tenant",
socket: #Phoenix.LiveView.Socket<
id: "phx-F3YXwxGfYHWbADEG",
endpoint: KickplanWeb.Endpoint,
view: AshAdmin.PageLive,
parent_pid: nil,
root_pid: nil,
router: KickplanWeb.Router,
assigns: #Phoenix.LiveView.Socket.AssignsNotInSocket<>,
transport_pid: nil,
...
>,
tenant: nil
}
(ash_admin 0.9.0) lib/ash_admin/components/top_nav/tenant_form.ex:13: anonymous fn/2 in AshAdmin.Components.TopNav.TenantForm."render (overridable 1)"/1
(phoenix_live_view 0.19.5) lib/phoenix_live_view/diff.ex:386: Phoenix.LiveView.Diff.traverse/7
(phoenix_live_view 0.19.5) lib/phoenix_live_view/diff.ex:711: Phoenix.LiveView.Diff.render_component/9
(phoenix_live_view 0.19.5) lib/phoenix_live_view/diff.ex:657: anonymous fn/5 in Phoenix.LiveView.Diff.render_pending_components/6
(elixir 1.15.4) lib/enum.ex:2510: Enum."-reduce/3-lists^foldl/2-0-"/3
(stdlib 4.3) maps.erl:411: :maps.fold_1/3
(phoenix_live_view 0.19.5) lib/phoenix_live_view/diff.ex:629: Phoenix.LiveView.Diff.render_pending_components/6
(phoenix_live_view 0.19.5) lib/phoenix_live_view/diff.ex:143: Phoenix.LiveView.Diff.render/3
(phoenix_live_view 0.19.5) lib/phoenix_live_view/static.ex:252: Phoenix.LiveView.Static.to_rendered_content_tag/4
(phoenix_live_view 0.19.5) lib/phoenix_live_view/static.ex:135: Phoenix.LiveView.Static.render/3
(phoenix_live_view 0.19.5) lib/phoenix_live_view/controller.ex:39: Phoenix.LiveView.Controller.live_render/3
(phoenix 1.7.7) lib/phoenix/router.ex:430: Phoenix.Router.__call__/5
(kickplan 0.1.0) lib/kickplan_web/endpoint.ex:1: KickplanWeb.Endpoint.plug_builder_call/2
(kickplan 0.1.0) deps/plug/lib/plug/debugger.ex:136: KickplanWeb.Endpoint."call (overridable 3)"/2
(kickplan 0.1.0) lib/kickplan_web/endpoint.ex:1: KickplanWeb.Endpoint.call/2
(phoenix 1.7.7) lib/phoenix/endpoint/sync_code_reload_plug.ex:22: Phoenix.Endpoint.SyncCodeReloadPlug.do_call/4
(plug_cowboy 2.6.1) lib/plug/cowboy/handler.ex:11: Plug.Cowboy.Handler.init/2
(cowboy 2.10.0) /workspace/app/deps/cowboy/src/cowboy_handler.erl:37: :cowboy_handler.execute/2
(cowboy 2.10.0) /workspace/app/deps/cowboy/src/cowboy_stream_h.erl:306: :cowboy_stream_h.execute/3
(cowboy 2.10.0) /workspace/app/deps/cowboy/src/cowboy_stream_h.erl:295: :cowboy_stream_h.request_process/3
** (KeyError) key :editing_tenant not found in: %{
__changed__: %{
clear_tenant: true,
flash: true,
id: true,
set_tenant: true,
tenant: true
},
__given__: %{
__changed__: %{
clear_tenant: true,
flash: true,
id: true,
set_tenant: true,
tenant: true
},
clear_tenant: "clear_tenant",
flash: %{},
id: "tenant_editor",
myself: %Phoenix.LiveComponent.CID{cid: 7},
set_tenant: "set_tenant",
socket: #Phoenix.LiveView.Socket<
id: "phx-F3YXwxGfYHWbADEG",
endpoint: KickplanWeb.Endpoint,
view: AshAdmin.PageLive,
parent_pid: nil,
root_pid: nil,
router: KickplanWeb.Router,
assigns: #Phoenix.LiveView.Socket.AssignsNotInSocket<>,
transport_pid: nil,
...
>,
tenant: nil
},
clear_tenant: "clear_tenant",
flash: %{},
id: "tenant_editor",
myself: %Phoenix.LiveComponent.CID{cid: 7},
set_tenant: "set_tenant",
socket: #Phoenix.LiveView.Socket<
id: "phx-F3YXwxGfYHWbADEG",
endpoint: KickplanWeb.Endpoint,
view: AshAdmin.PageLive,
parent_pid: nil,
root_pid: nil,
router: KickplanWeb.Router,
assigns: #Phoenix.LiveView.Socket.AssignsNotInSocket<>,
transport_pid: nil,
...
>,
tenant: nil
}
(ash_admin 0.9.0) lib/ash_admin/components/top_nav/tenant_form.ex:13: anonymous fn/2 in AshAdmin.Components.TopNav.TenantForm."render (overridable 1)"/1
(phoenix_live_view 0.19.5) lib/phoenix_live_view/diff.ex:386: Phoenix.LiveView.Diff.traverse/7
(phoenix_live_view 0.19.5) lib/phoenix_live_view/diff.ex:711: Phoenix.LiveView.Diff.render_component/9
(phoenix_live_view 0.19.5) lib/phoenix_live_view/diff.ex:657: anonymous fn/5 in Phoenix.LiveView.Diff.render_pending_components/6
(elixir 1.15.4) lib/enum.ex:2510: Enum."-reduce/3-lists^foldl/2-0-"/3
(stdlib 4.3) maps.erl:411: :maps.fold_1/3
(phoenix_live_view 0.19.5) lib/phoenix_live_view/diff.ex:629: Phoenix.LiveView.Diff.render_pending_components/6
(phoenix_live_view 0.19.5) lib/phoenix_live_view/diff.ex:143: Phoenix.LiveView.Diff.render/3
(phoenix_live_view 0.19.5) lib/phoenix_live_view/static.ex:252: Phoenix.LiveView.Static.to_rendered_content_tag/4
(phoenix_live_view 0.19.5) lib/phoenix_live_view/static.ex:135: Phoenix.LiveView.Static.render/3
(phoenix_live_view 0.19.5) lib/phoenix_live_view/controller.ex:39: Phoenix.LiveView.Controller.live_render/3
(phoenix 1.7.7) lib/phoenix/router.ex:430: Phoenix.Router.__call__/5
(kickplan 0.1.0) lib/kickplan_web/endpoint.ex:1: KickplanWeb.Endpoint.plug_builder_call/2
(kickplan 0.1.0) deps/plug/lib/plug/debugger.ex:136: KickplanWeb.Endpoint."call (overridable 3)"/2
(kickplan 0.1.0) lib/kickplan_web/endpoint.ex:1: KickplanWeb.Endpoint.call/2
(phoenix 1.7.7) lib/phoenix/endpoint/sync_code_reload_plug.ex:22: Phoenix.Endpoint.SyncCodeReloadPlug.do_call/4
(plug_cowboy 2.6.1) lib/plug/cowboy/handler.ex:11: Plug.Cowboy.Handler.init/2
(cowboy 2.10.0) /workspace/app/deps/cowboy/src/cowboy_handler.erl:37: :cowboy_handler.execute/2
(cowboy 2.10.0) /workspace/app/deps/cowboy/src/cowboy_stream_h.erl:306: :cowboy_stream_h.execute/3
(cowboy 2.10.0) /workspace/app/deps/cowboy/src/cowboy_stream_h.erl:295: :cowboy_stream_h.request_process/3
3 Replies
I believe this is just a bug 🙂 We recently moved
ash_admin
from surface to regular liveview, and there were a few things we missed along the way
Just pushed to main
with a fix 🙂That resolved the error but I have "No Tenant". Is there some way to configure tenant switching or should I pass set that in a plug?
I'm also getting
Would be nice to be able to configure tenant selection as a select input by setting providing tenant options in an assigns.
no route found for POST /admin (KickplanWeb.Router)
even though I'm on main. I see there's another thread covering that so I'll check that out.
Fixed most my issues with content-security-policy changes.
Still can't select a tenant:
[error] GenServer #PID<0.4922.0> terminating
** (FunctionClauseError) no function clause matching in AshAdmin.PageLive.handle_event/3
(ash_admin 0.9.0) lib/ash_admin/pages/page_live.ex:284: AshAdmin.PageLive.handle_event("stop_editing_tenant", %{"value" => ""}, #Phoenix.LiveView.Socket<id: "phx-F3YupvdZ02N11DZB", endpoint: KickplanWeb.Endpoint, view: AshAdmin.PageLive, parent_pid: nil, root_pid: #PID<0.4922.0>, router: KickplanWeb.Router, assigns: %{__changed__: %{}, action: %Ash.Resource.Actions.Read{arguments: [], description: nil, filter: nil, get_by: nil, get?: false, manual: nil, metadata: [], modify_query: nil, name: :read, pagination: false, preparations: [], primary?: true, touches_resources: [], transaction?: false, type: :read}, action_type: :read, actor: nil, actor_api: nil, actor_paused: true, actor_resources: [], api: Kickplan.Environments, apis: [Kickplan.Organizations, Kickplan.Users, Kickplan.Environments], authorizing: false, flash: %{}, id: nil, live_action: :page, params: %{"action" => "read", "action_type" => "read", "api" => "Environments", "resource" => "Account", "route" => [], "table" => ""}, polymorphic_actions: nil, prefix: "/admin", primary_key: nil, record: nil, resource: Kickplan.Environments.Account, tab: nil, table: nil, tables: [], tenant: nil, url_path: "/admin"}, transport_pid: #PID<0.4910.0>, ...>)
(phoenix_live_view 0.19.5) lib/phoenix_live_view/channel.ex:401: anonymous fn/3 in Phoenix.LiveView.Channel.view_handle_event/3
(telemetry 1.2.1) /workspace/app/deps/telemetry/src/telemetry.erl:321: :telemetry.span/3
(phoenix_live_view 0.19.5) lib/phoenix_live_view/channel.ex:221: Phoenix.LiveView.Channel.handle_info/2
(stdlib 4.3) gen_server.erl:1123: :gen_server.try_dispatch/4
(stdlib 4.3) gen_server.erl:1200: :gen_server.handle_msg/6
(stdlib 4.3) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
Last message: %Phoenix.Socket.Message{topic: "lv:phx-F3YupvdZ02N11DZB", event: "event", payload: %{"event" => "stop_editing_tenant", "type" => "click", "value" => %{"value" => ""}}, ref: "7", join_ref: "4"}
[error] GenServer #PID<0.4922.0> terminating
** (FunctionClauseError) no function clause matching in AshAdmin.PageLive.handle_event/3
(ash_admin 0.9.0) lib/ash_admin/pages/page_live.ex:284: AshAdmin.PageLive.handle_event("stop_editing_tenant", %{"value" => ""}, #Phoenix.LiveView.Socket<id: "phx-F3YupvdZ02N11DZB", endpoint: KickplanWeb.Endpoint, view: AshAdmin.PageLive, parent_pid: nil, root_pid: #PID<0.4922.0>, router: KickplanWeb.Router, assigns: %{__changed__: %{}, action: %Ash.Resource.Actions.Read{arguments: [], description: nil, filter: nil, get_by: nil, get?: false, manual: nil, metadata: [], modify_query: nil, name: :read, pagination: false, preparations: [], primary?: true, touches_resources: [], transaction?: false, type: :read}, action_type: :read, actor: nil, actor_api: nil, actor_paused: true, actor_resources: [], api: Kickplan.Environments, apis: [Kickplan.Organizations, Kickplan.Users, Kickplan.Environments], authorizing: false, flash: %{}, id: nil, live_action: :page, params: %{"action" => "read", "action_type" => "read", "api" => "Environments", "resource" => "Account", "route" => [], "table" => ""}, polymorphic_actions: nil, prefix: "/admin", primary_key: nil, record: nil, resource: Kickplan.Environments.Account, tab: nil, table: nil, tables: [], tenant: nil, url_path: "/admin"}, transport_pid: #PID<0.4910.0>, ...>)
(phoenix_live_view 0.19.5) lib/phoenix_live_view/channel.ex:401: anonymous fn/3 in Phoenix.LiveView.Channel.view_handle_event/3
(telemetry 1.2.1) /workspace/app/deps/telemetry/src/telemetry.erl:321: :telemetry.span/3
(phoenix_live_view 0.19.5) lib/phoenix_live_view/channel.ex:221: Phoenix.LiveView.Channel.handle_info/2
(stdlib 4.3) gen_server.erl:1123: :gen_server.try_dispatch/4
(stdlib 4.3) gen_server.erl:1200: :gen_server.handle_msg/6
(stdlib 4.3) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
Last message: %Phoenix.Socket.Message{topic: "lv:phx-F3YupvdZ02N11DZB", event: "event", payload: %{"event" => "stop_editing_tenant", "type" => "click", "value" => %{"value" => ""}}, ref: "7", join_ref: "4"}
could you open an issue on ash admin for that one? i'll fix that in the next few days