ash-project / ash_admin

A super-admin UI dashboard for Ash Framework applications, built with Phoenix LiveView.
https://hexdocs.pm/ash_admin
MIT License
106 stars 48 forks source link

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

Closed renews closed 10 months ago

renews commented 10 months ago

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

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 10 months ago

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 10 months ago

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"},
zachdaniel commented 10 months ago

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

renews commented 10 months ago

Thank you for fixing it so fast :)