phoenixframework / phoenix_live_dashboard

Realtime dashboard with metrics, request logging, plus storage, OS and VM insights

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crash when mounting the dashboard on "/"

cblavier opened this issue · comments

I'm using the dashboard as a dedicated application of our umbrella app.

With the following route, I get 500 errors as it seems to generate a path with double slashes (like "//home")
Assets path are also concerned with the issue

  scope "/" do
    pipe_through(:browser)

    live_dashboard("/",
      live_socket_path: "/phenix_dashboard/live",
      metrics: PhenixDashboard.Telemetry,
      request_logger_cookie_domain: :parent,
      ecto_repos: [PhenixDisplays.Repo]
    )
  end
[error] #PID<0.1960.0> running MainProxy.Plug (connection #PID<0.1959.0>, stream id 1) terminated
Server: dashboard.localhost.dev:80 (http)
Request: GET /
** (exit) an exception was raised:
    ** (ArgumentError) the :to option in push_redirect/2 expects a path but was "//home"
        (phoenix_live_view 0.20.1) lib/phoenix_live_view.ex:1207: Phoenix.LiveView.raise_invalid_local_url!/2
        (phoenix_live_view 0.20.1) lib/phoenix_live_view.ex:1175: Phoenix.LiveView.push_opts!/2
        (phoenix_live_view 0.20.1) lib/phoenix_live_view.ex:1169: Phoenix.LiveView.push_redirect/2
        (phoenix_live_dashboard 0.8.2) lib/phoenix/live_dashboard/page_live.ex:38: Phoenix.LiveDashboard.PageLive.mount/3
        (phoenix_live_view 0.20.1) lib/phoenix_live_view/utils.ex:394: anonymous fn/6 in Phoenix.LiveView.Utils.maybe_call_live_view_mount!/5

Would you like a PR to get it fixed?

Yes :)