I'm getting this error when trying to use Phoenix Live Dashboard
[2022-04-27 10:15:55.423][][error] #PID<0.4393.0> running gerardWeb.Endpoint (connection #PID<0.4388.0>, stream id 2) terminated
Server: localhost:4000 (http)
Request: GET /dashboard/home
** (exit) an exception was raised:
** (UndefinedFunctionError) function Phoenix.HTML.attributes_escape/1 is undefined or private
(phoenix_html) Phoenix.HTML.attributes_escape([{{:safe, "data-page"}, :home}])
(phoenix_live_dashboard) lib/phoenix/live_dashboard/page_live.ex:3: anonymous fn/2 in Phoenix.LiveDashboard.PageLive.render/1
(phoenix_live_view) lib/phoenix_live_view/diff.ex:387: Phoenix.LiveView.Diff.traverse/7
(phoenix_live_view) lib/phoenix_live_view/diff.ex:494: anonymous fn/4 in Phoenix.LiveView.Diff.traverse_dynamic/7
(elixir) lib/enum.ex:1925: Enum."-reduce/3-lists^foldl/2-0-"/3
(phoenix_live_view) lib/phoenix_live_view/diff.ex:387: Phoenix.LiveView.Diff.traverse/7
(phoenix_live_view) lib/phoenix_live_view/diff.ex:138: Phoenix.LiveView.Diff.render/3
(phoenix_live_view) lib/phoenix_live_view/static.ex:244: Phoenix.LiveView.Static.to_rendered_content_tag/4
(phoenix_live_view) lib/phoenix_live_view/static.ex:126: Phoenix.LiveView.Static.render/3
(phoenix_live_view) lib/phoenix_live_view/controller.ex:39: Phoenix.LiveView.Controller.live_render/3
(phoenix) lib/phoenix/router.ex:355: Phoenix.Router.__call__/2
(gerard) lib/plug/error_handler.ex:80: gerardWeb.Router.call/2
(gerard) lib/gerard_web/endpoint.ex:1: gerardWeb.Endpoint.plug_builder_call/2
(gerard) lib/plug/debugger.ex:136: gerardWeb.Endpoint."call (overridable 3)"/2
(gerard) lib/gerard_web/endpoint.ex:1: gerardWeb.Endpoint.call/2
(phoenix) lib/phoenix/endpoint/cowboy2_handler.ex:54: Phoenix.Endpoint.Cowboy2Handler.init/4
(cowboy) /home/txhgkl/Documents/blink/gerard/deps/cowboy/src/cowboy_handler.erl:37: :cowboy_handler.execute/2
(cowboy) /home/txhgkl/Documents/blink/gerard/deps/cowboy/src/cowboy_stream_h.erl:300: :cowboy_stream_h.execute/3
(cowboy) /home/txhgkl/Documents/blink/gerard/deps/cowboy/src/cowboy_stream_h.erl:291: :cowboy_stream_h.request_process/3
(stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/
My dependencies looks like this:
{:ecto_sql, "~> 3.6.2"},
{:phoenix, "~> 1.6.0"},
{:phoenix_live_view, "~> 0.17.7"},
{:phoenix_html, "~> 2.9", override: true},
{:phoenix_pubsub, "~> 2.0"},
{:phoenix_live_dashboard, "~> 0.6.5", override: true},
{:postgrex, "~> 0.15"},
I already tried to downgrade my phoenix_live_dashboard to 0.5
and 0.4
and the same problem happens again
The first version of
phoenix_html
to contain a definition forPhoenix.HTML.attributes_escape/1
is 3.1.0, but you forcibly override the dependency with{:phoenix_html, "~> 2.9", override: true}
to use an older version.Remove the
override: true
opt and specify a version at least"~> 3.1"
(at the time of this writing, 3.2.0 was the latest available). If you have a convergent dependency resolution issue, you can either update the older dependencies that expect the old 2.9.x version or put the override option back in place and test to make sure the new version doesn't have any changes that break your app.The documentation for this function is available on hexdocs and you can observe that if you switch hexdocs to
v2.9.x
the function is not defined.