LiveView leex file throwing error even when empty

Hello all,

I’m getting this error in LiveView, even when the referenced html.leex file in the error is empty!

There was a call to RocketshipWeb.Router.Helpers.chat_show_path/3 but then I changed it to RocketshipWeb.Router.Helpers.chat_show_path/4 and the error message stayed. Then I deleted everything in the html.leex file and still the same error message.

Thanks for any help.

[error] #PID<0.609.0> running RocketshipWeb.Endpoint (connection #PID<0.579.0>, stream id 6) terminated
Server: localhost:4000 (http)
Request: GET /programs/62/chats/14
** (exit) an exception was raised:
    ** (UndefinedFunctionError) function RocketshipWeb.Router.Helpers.chat_show_path/3 is undefined or private
        (rocketship 0.1.0) RocketshipWeb.Router.Helpers.chat_show_path(#Phoenix.LiveView.Socket<assigns: #Phoenix.LiveView.Socket.AssignsNotInSocket<>, changed: %{chat: true, page_title: true}, endpoint: RocketshipWeb.Endpoint, id: "phx-Fke9HKBk7TDsPwLh", parent_pid: nil, root_pid: nil, router: RocketshipWeb.Router, view: RocketshipWeb.ChatLive.Show, ...>, :edit, %Rocketship.Chats.Chat{__meta__: #Ecto.Schema.Metadata<:loaded, "chats">, chats_users: #Ecto.Association.NotLoaded<association :chats_users is not loaded>, cohort: #Ecto.Association.NotLoaded<association :cohort is not loaded>, cohort_id: 2, id: 14, inserted_at: ~N[2020-11-14 15:00:00], is_pinned: false, last_message: nil, name: "Encubay Cohort 1", organization: #Ecto.Association.NotLoaded<association :organization is not loaded>, organization_id: 2, parent_organization: #Ecto.Association.NotLoaded<association :parent_organization is not loaded>, parent_organization_id: 1, team: #Ecto.Association.NotLoaded<association :team is not loaded>, team_id: nil, type: "Cohort", updated_at: ~N[2020-11-14 15:00:00], users: #Ecto.Association.NotLoaded<association :users is not loaded>})
        (rocketship 0.1.0) lib/rocketship_web/live/chat_live/show.html.leex:36: anonymous fn/2 in RocketshipWeb.ChatLive.Show.render/1
        (phoenix_live_view 0.14.8) lib/phoenix_live_view/diff.ex:303: Phoenix.LiveView.Diff.traverse/6
        (phoenix_live_view 0.14.8) lib/phoenix_live_view/diff.ex:377: anonymous fn/4 in Phoenix.LiveView.Diff.traverse_dynamic/6
        (elixir 1.10.4) lib/enum.ex:2111: Enum."-reduce/3-lists^foldl/2-0-"/3
        (phoenix_live_view 0.14.8) lib/phoenix_live_view/diff.ex:303: Phoenix.LiveView.Diff.traverse/6
        (phoenix_live_view 0.14.8) lib/phoenix_live_view/diff.ex:111: Phoenix.LiveView.Diff.render/3
        (phoenix_live_view 0.14.8) lib/phoenix_live_view/static.ex:284: Phoenix.LiveView.Static.to_rendered_content_tag/4
        (phoenix_live_view 0.14.8) lib/phoenix_live_view/static.ex:144: Phoenix.LiveView.Static.render/3
        (phoenix_live_view 0.14.8) lib/phoenix_live_view/controller.ex:35: Phoenix.LiveView.Controller.live_render/3
        (phoenix 1.5.6) lib/phoenix/router.ex:352: Phoenix.Router.__call__/2
        (rocketship 0.1.0) lib/rocketship_web/endpoint.ex:1: RocketshipWeb.Endpoint.plug_builder_call/2
        (rocketship 0.1.0) lib/plug/debugger.ex:132: RocketshipWeb.Endpoint."call (overridable 3)"/2
        (rocketship 0.1.0) lib/rocketship_web/endpoint.ex:1:
        (phoenix 1.5.6) lib/phoenix/endpoint/cowboy2_handler.ex:65: Phoenix.Endpoint.Cowboy2Handler.init/4
        (cowboy 2.8.0) /Users/Owens/Code/Elixir/rocketship/deps/cowboy/src/cowboy_handler.erl:37: :cowboy_handler.execute/2
        (cowboy 2.8.0) /Users/Owens/Code/Elixir/rocketship/deps/cowboy/src/cowboy_stream_h.erl:300: :cowboy_stream_h.execute/3
        (cowboy 2.8.0) /Users/Owens/Code/Elixir/rocketship/deps/cowboy/src/cowboy_stream_h.erl:291: :cowboy_stream_h.request_process/3
        (stdlib 3.13) proc_lib.erl:226: :proc_lib.init_p_do_apply/3

UPDATE: The issue was I renamed the html.leex to html.slimleex to use the slime engine before deleting the contents. Somehow it appears the contents from the html.leex template was stuck in memory? Because when I renamed it back to html.leex with no contents the problem went away (the page loaded without error and was empty). But now I can’t get anything to save when the file type is html.slimleex, even though I have another file in the directory with html.slimleex that updates fine…

Any help or thoughts here greatly appreciated.

Strangely. Closing Chrome and everything, as well as restarting my computer fixed this.

1 Like

If I recall correctly I’ve fixed a similar error in the past by restarting the phoenix server (or maybe I had to run mix clean also).

1 Like

Template changes are tracked with the ˋ@external_resourceˋ module attribute, which uses paths to reference the external file.

1 Like

Restarting the phoenix server didn’t fix it for me. Only going back to the leex extension instead of slimleex or staying with the slimleex extension and completely restarting my computer and Chrome browser.

1 Like