Fl4m3Ph03n1x
Background
I have created a fresh Phoenix app using mix phx.new.web web_interface --no-dashboard --no-ecto --no-gettext --no-mailer inside an Umbrella app.
After following the basic installation instructions for the dependencies and changing my application.ex to:
defmodule WebInterface.Application do
use Application
alias Desktop
alias WebInterface.{Endpoint, Telemetry, PubSub}
alias WebInterface.Live.MenuBar
@impl true
def start(_type, _args) do
children = [
Telemetry,
{Phoenix.PubSub, name: PubSub},
Endpoint,
{Desktop.Window,
[
app: :web_interface,
id: WebInterface,
title: "Market Manager",
size: {940, 980},
menubar: MenuBar,
icon: "static/images/resized_logo_5_32x32.png",
url: &WebInterface.Endpoint.url/0
]}
]
opts = [strategy: :one_for_one, name: WebInterface.Supervisor]
Supervisor.start_link(children, opts)
end
# boilerplate code bellow
end
I was able to launch my Desktop application and have it working.
Problem
However, after changing endpoint.ex following the instruction #3 here:
I was no longer able to launch the application due to an error:
08:30:14.411 [notice] Application runtime_tools exited: :stopped
** (Mix) Could not start application web_interface: WebInterface.Application.start(:normal, []) returned an error: shutdown: failed to start child: WebInterface.Endpoint
** (EXIT) an exception was raised:
** (UndefinedFunctionError) function Phoenix.Endpoint.Supervisor.url/1 is undefined or private
(phoenix 1.7.2) Phoenix.Endpoint.Supervisor.url(WebInterface.Endpoint)
(phoenix 1.7.2) lib/phoenix/config.ex:65: Phoenix.Config.cache/3
(web_interface 2.2.0) lib/web_interface/endpoint.ex:2: WebInterface.Endpoint.url/0
(phoenix 1.7.2) lib/phoenix/endpoint/supervisor.ex:425: Phoenix.Endpoint.Supervisor.log_access_url/2
(phoenix 1.7.2) lib/phoenix/endpoint/supervisor.ex:17: Phoenix.Endpoint.Supervisor.start_link/3
(stdlib 4.1.1) supervisor.erl:414: :supervisor.do_start_child_i/3
(stdlib 4.1.1) supervisor.erl:400: :supervisor.do_start_child/2
(stdlib 4.1.1) supervisor.erl:384: anonymous fn/3 in :supervisor.start_children/2
To me, this indicates that changing Phoenix.Endpoint to Desktop.Endpoint is no longer necessary.
Question
- Is the documentation outdated?
- If not, am I missing something? Given that before the change the application worked, what could be causing the issue (assuming the change is indeed necessary)?
It is worth noting however, that the creation of Phoenix projects inside Umbrella applications is currently bugged (see: Phoenix 1.7 welcome page assets not showing properly) but I don’t think this is related.
Trending in Questions
Other Trending Topics
Latest Phoenix Threads
Latest in /Elixir Desktop
Latest on Elixir Forum
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixirconf-us
- #ai
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #hex
- #security










Showing Posts 1 to 4- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
al2o3cr
The
Phoenix.Endpoint.Supervisor.url/1function this is trying to call went away in this commit:https://github.com/phoenixframework/phoenix/commit/4e57eeef58b59f20c670790f50e1082b41e32a97
What version of LiveView are you using? Seems like it should be taking the
elsehere but is actually doing theif:https://github.com/elixir-desktop/desktop/blob/bab89d1701064ced6fd54de4630cc741f53ab9a2/lib/desktop/endpoint.ex#L11-L19
Fl4m3Ph03n1x
This is what I am using:
This is the source of
Desktop.EndpointI currently have:There is no
ifstatement here. Perhaps the latest version is not in hex?Fl4m3Ph03n1x
I finally found what is happening here, special thanks to @al2o3cr .
So, what is happening is twofold:
Looking at the source code from Desktop 1.4,
Desktop.Endpointdoes not differentiate between LiveView versions, and only works for LiveView < 1.18.After updating Desktop to 1.5, the issue is solved. The documentation needs updating.
Fl4m3Ph03n1x
For those of you curious, here is the PR I made for it: Changing endpoint.ex to "use Desktop.Endpoint" breaks Desktop app · Issue #39 · elixir-desktop/desktop · GitHub