scoutapp / scout_apm_elixir

ScoutAPM Elixir Agent. Supports Phoenix and other frameworks.
https://scoutapm.com
Other
36 stars 20 forks source link

Building Phoenix Live Dashboard fails for undefined ScoutApm.Instruments.EExEngine.compile/2 #118

Open simedw opened 3 years ago

simedw commented 3 years ago

I have been using scout apm for a while now, and recently added phoenix live dashboard to one of my projects, however when compiling the dependencies from scratch (rm -rf _build && mix deps.compile) phoenix_live_dashboard gets compiled before scoutapm. This causes it to crash since it's trying to use ScoutApm.Instruments.EExEngine.compile which is not yet defined.

Here is the rough output

...
==> phoenix_live_dashboard
Compiling 36 files (.ex)

== Compilation error in file lib/phoenix/live_dashboard/layout_view.ex ==
** (UndefinedFunctionError) function ScoutApm.Instruments.EExEngine.compile/2 is undefined (module ScoutApm.Instruments.EExEngine is not available)
    ScoutApm.Instruments.EExEngine.compile("lib/phoenix/live_dashboard/templates/layout/dash.html.eex", "dash.html")
    (phoenix 1.5.7) lib/phoenix/template.ex:351: Phoenix.Template.compile/3
    (phoenix 1.5.7) lib/phoenix/template.ex:166: anonymous fn/4 in Phoenix.Template."MACRO-__before_compile__"/2
    (elixir 1.10.4) lib/enum.ex:2111: Enum."-reduce/3-lists^foldl/2-0-"/3
    (phoenix 1.5.7) expanding macro: Phoenix.Template.__before_compile__/1
    lib/phoenix/live_dashboard/layout_view.ex:1: Phoenix.LiveDashboard.LayoutView (module)
could not compile dependency :phoenix_live_dashboard, "mix compile" failed. You can recompile this dependency with "mix deps.compile phoenix_live_dashboard", update it with "mix deps.update phoenix_live_dashboard" or clean it with "mix deps.clean phoenix_live_dashboard"

After a quick search I found that someone opened it as an issue on the Phoenix Live Dashboard repo, but it got closed: https://github.com/phoenixframework/phoenix_live_dashboard/issues/60

cschneid commented 3 years ago

Did either of the workarounds work for this? Either moving the order of deps around, or doing the custom compiler defmodule Mix.Tasks.Compile.ScoutAppTemplates do?