Ash Admin missing PageLive __live__

I was trying to set up Ash Admin for a small experiment project.

Request: GET /admin
** (exit) an exception was raised:
    ** (UndefinedFunctionError) function FamWeb.AshAdmin.PageLive.__live__/0 is undefined (module FamWeb.AshAdmin.PageLive is not available)
        FamWeb.AshAdmin.PageLive.__live__()
        (phoenix_live_view 0.18.18) lib/phoenix_live_view/static.ex:257: Phoenix.LiveView.Static.load_live!/2
        (phoenix_live_view 0.18.18) lib/phoenix_live_view/static.ex:91: Phoenix.LiveView.Static.render/3
        (phoenix_live_view 0.18.18) 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
        (fam 0.1.0) lib/fam_web/endpoint.ex:1: FamWeb.Endpoint.plug_builder_call/2
        (fam 0.1.0) lib/plug/debugger.ex:136: FamWeb.Endpoint."call (overridable 3)"/2
        (fam 0.1.0) lib/fam_web/endpoint.ex:1: FamWeb.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) /home/lawik/projects/fam/deps/cowboy/src/cowboy_handler.erl:37: :cowboy_handler.execute/2
        (cowboy 2.10.0) /home/lawik/projects/fam/deps/cowboy/src/cowboy_stream_h.erl:306: :cowboy_stream_h.execute/3
        (cowboy 2.10.0) /home/lawik/projects/fam/deps/cowboy/src/cowboy_stream_h.erl:295: :cowboy_stream_h.request_process/3
        (stdlib 4.0.1) proc_lib.erl:240: :proc_lib.init_p_do_apply/3

From the instructions I don’t believe I’ve missed anything at this point. But I’m clearly missing a generated LiveView in some way.

Api file:

defmodule Fam.Api do
  use Ash.Api, extensions: [AshAdmin.Api]

  resources do
    registry Fam.Site.Registry
  end

  admin do
    show? true
  end
end

I have one resource and it all matches the base getting started tutorial aside from some names.

      {:phoenix, "~> 1.7.2"},
      {:phoenix_live_view, "~> 0.18.16", override: true},
      {:ash, "~> 2.15"},
      {:ash_admin, "~> 0.9.4"},
      {:ash_postgres, "~> 1.3"},
      {:ash_phoenix, "~> 1.2"}

Any idea what I’m hitting here?

1 Like

Found it. I had:

  scope "/", FamWeb do
    pipe_through :browser

    ash_admin "/admin"
  end

instead of

  scope "/" do
    pipe_through :browser

    ash_admin("/admin")
  end

Problem makes sense. Was very confused :smiley:

6 Likes

Thank you that is very helpful,
for all the ones who are a bit blind like me, and need a bit of context
lawik did a seperate scope for “/” because the FamWeb in

Scope "/", FamWeb do

is used as prefix.
thats why lawik has

FamWeb.AshAdmin.PageLive

in the error message.

i got the explanation from a forum post at ash_hq