ash-project/ash_admin

function Phoenix.HTML.Tag.csrf_meta_tag/0 is undefined (module Phoenix.HTML.Tag is not available)

Closed this issue · 4 comments

renews commented

Describe the bug

#AshAdmin
When loading the url set up on the router, the error pop up

To Reproduce

Just followed the readme to implement it on my small project (2 API's)

defmodule MyApp.Accounts.User do
  use Ash.Resource,
    data_layer: AshPostgres.DataLayer,
    extensions: [AshAuthentication, AshAdmin.Resource],
    authorizers: [Ash.Policy.Authorizer]

  admin do
    actor?(true)
  end

And the second one

defmodule MyApp.Items.Item do
  use Ash.Resource,
    data_layer: AshPostgres.DataLayer,
    authorizers: [Ash.Policy.Authorizer],
    extensions: [AshAdmin.Resource]

Expected behavior

To open the admin

Runtime

  • Elixir version: Elixir 1.15.7 (compiled with Erlang/OTP 26)
  • Erlang version: 26.1.1
  • OS: macos-x64
  • Ash version 2.18
  • any related extension versions
    {:ash, "> 2.18"},
    {:ash_admin, "
    > 0.10"},
    {:ash_authentication, "> 3.12"},
    {:ash_authentication_phoenix, "
    > 1.9"},
    {:ash_phoenix, "> 1.3"},
    {:ash_postgres, "
    > 1.4"},

Additional context

New to Ash, so I guess im doing something wrong, sry

Router file

  use AshAuthentication.Phoenix.Router
  import AshAdmin.Router

  pipeline :browser do
    plug :accepts, ["html"]
    plug :fetch_session
    plug :fetch_live_flash
    plug :put_root_layout, {MyAppWeb.Layouts, :root}
    plug :protect_from_forgery
    # plug :put_secure_browser_headers
    plug :put_secure_browser_headers, %{
      "content-security-policy" => "default-src 'nonce-ash_admin-Ed55GFnX' 'self'"
    }

    # Ash AUTHENTICATION
    plug :load_from_session
  end

And the related route

  # ONLY for AshAdmin
  scope "/" do
    pipe_through :browser

    ash_admin("/admin")
  end

  scope "/", MyAppWeb do
    pipe_through :browser
renews commented

Might be because AshAdmin depends on PhoenixHTML 3.2 and AshPhoenix on PhoenixHTML 4.0.
Im using override on the phoenix_html package to circumvent the dependency error, but this can be some side effect

renews commented

Yeah, that was it reverting ashphoenix to the latest 1.2 worked. Below is the versions that im using for it to work

{:ash_admin, "~> 0.10"},
{:ash_phoenix, "~> 1.2"},
{:phoenix_html, "~> 3.2"},

Thank you for reporting the issue. Fixed in main, includes a hard requirement on phoenix_html 4.0

renews commented

Thank you for fixing it so fast :)