Fl4m3Ph03n1x

Fl4m3Ph03n1x

Unknown registry: MyApp.Pubsub

Background

I have a Phoenix LiveView App inside an umbrella project which is basically a HelloWorld project.
In This Phoenix App is special though, in that it is a Desktop App:

My Phoenix app does not use Ecto nor any DB, so I had to add the usual PubSub line to the supervision tree in application.ex.

Problem

Everything works as expected, except when I close the application. Upon closing it I get an error:

12:19:22.507 [error] GenServer #PID<0.553.0> terminating
** (ArgumentError) unknown registry: WebInterface.PubSub
    (elixir 1.13.1) lib/registry.ex:1334: Registry.info!/1
    (elixir 1.13.1) lib/registry.ex:985: Registry.register/3
    (phoenix_pubsub 2.0.0) lib/phoenix/pubsub.ex:117: Phoenix.PubSub.subscribe/3
    (phoenix 1.6.5) lib/phoenix/channel/server.ex:419: Phoenix.Channel.Server.init_join/3
    (phoenix 1.6.5) lib/phoenix/channel/server.ex:378: Phoenix.Channel.Server.channel_join/4
    (phoenix 1.6.5) lib/phoenix/channel/server.ex:298: Phoenix.Channel.Server.handle_info/2
    (stdlib 3.16.1) gen_server.erl:695: :gen_server.try_dispatch/4
    (stdlib 3.16.1) gen_server.erl:771: :gen_server.handle_msg/6
Last message: {Phoenix.Channel, %{}, {#PID<0.541.0>, #Reference<0.3172133806.691273734.151736>}, %Phoenix.Socket{assigns: %{}, channel: Phoenix.LiveReloader.Channel, channel_pid: nil, endpoint: WebInterface.Endpoint, handler: Phoenix.LiveReloader.Socket, id: nil, join_ref: "4", joined: false, private: %{}, pubsub_server: WebInterface.PubSub, ref: nil, serializer: Phoenix.Socket.V2.JSONSerializer, topic: "phoenix:live_reload", transport: :websocket, transport_pid: #PID<0.541.0>}}
State: #Reference<0.3172133806.691273734.151738>

Here is my application.ex file:

defmodule WebInterface.Application do
  # See https://hexdocs.pm/elixir/Application.html
  # for more information on OTP Applications
  @moduledoc false

  use Application

    alias Desktop

  @impl true
  def start(_type, _args) do
    children = [
      WebInterface.Telemetry,
      WebInterface.Endpoint,
      {Phoenix.PubSub, name: WebInterface.PubSub},
      {Desktop.Window,
       [
         app: :web_interface,
         id: WebInterface,
         title: "Web Interface",
         size: {600, 500},
         menubar: WebInterface.MenuBar,
         url: &WebInterface.Endpoint.url/0
       ]}
    ]

    opts = [strategy: :one_for_one, name: WebInterface.Supervisor]
    Supervisor.start_link(children, opts)
  end

  @impl true
  def config_change(changed, _new, removed) do
    WebInterface.Endpoint.config_change(changed, removed)
    :ok
  end
end

What am I doing wrong?

Marked As Solved

kokolegorille

kokolegorille

You should probably start pubsub before the endpoint… the order matters

Also Liked

shahryarjb

shahryarjb

Hello, How to check Pubsub is started or not? Because I have a genserver sends data to my database, but I need to check Pubsub is started or not, if not I can return my genserver with a timeout until it is started.

Update

I found it, I thought Process.whereis just accepts pid

7stud

7stud

If you are getting the error:

(ArgumentError) unknown registry: AuctionWeb.PubSub

while trying to follow “Phoenix in Action 1.4”, then you are in luck! Go here:

Where Next?

Popular in Questions Top

sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
sergio
In Ruby, I can go: User.find_by(email: "foobar@email.com").update(email: "hello@email.com") How can I do something similar in Elixir? ...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
johnnyicon
Hi all, I’ve just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I’m trying to use Postgres...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: The documentation above suggests that while ...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
marick
I had some trouble figuring out how to make many-to-many associations work. Once I got it working, I wrote a blog post. Because I’m a nov...
New

Other popular topics Top

albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New

We're in Beta

About us Mission Statement