3

I recently upgraded the pubsub dependency in my project following the documentation, but I am getting this error whenever I run the server:

an exception was raised:
** (ArgumentError) unknown registry: Demo.PubSub
 (elixir 1.10.2) lib/registry.ex:1239: Registry.info!/1
 (elixir 1.10.2) lib/registry.ex:920: Registry.register/3
 (phoenix_pubsub 2.0.0) lib/phoenix/pubsub.ex:117: Phoenix.PubSub.subscribe/3
 (phoenix 1.5.8) lib/phoenix/channel/server.ex:420: Phoenix.Channel.Server.init_join/3
 (phoenix 1.5.8) lib/phoenix/channel/server.ex:378: Phoenix.Channel.Server.channel_join/4
 (phoenix 1.5.8) lib/phoenix/channel/server.ex:298: Phoenix.Channel.Server.handle_info/2
 (stdlib 3.7) gen_server.erl:637: :gen_server.try_dispatch/4
 (stdlib 3.7) gen_server.erl:711: :gen_server.handle_msg/6

Here is my application.ex

def start(_type, _args) do
# List all child processes to be supervised
children = [
 Demo.Repo,
 DemoWeb.Endpoint,
 {Demo.ExpireCodesJob, []},
 {Demo.DistributeCodesJob, []},
 {Oban, oban_config()},
 {Phoenix.PubSub, [name: Demo.PubSub, adapter: Phoenix.PubSub.PG2]},
 worker(PlugAttack.Storage.Ets, [Demo.PlugAttack.Storage, [clean_period: 60_000]])
]

Here is my config.ex

# Configures the endpoint
config :demo, DemoWeb.Endpoint,
 url: [host: System.get_env("HOST")],
 secret_key_base: System.get_env("SECRET_KEY_BASE"),
 render_errors: [view: DemoWeb.ErrorView, accepts: ~w(json)],
 pubsub_server: Demo.PubSub,
 check_origin: [...]

I've searched a lot about it, but since I am still a newbie, could not figure out where does it goes wrong. Please help me out.

Vadim Landa
2,8645 gold badges25 silver badges33 bronze badges
asked Apr 14, 2021 at 10:35
2
  • 1
    Configs look fine; I believe you just need to move {Phoenix.PubSub, name: Demo.PubSub} child on the top of the children list, like right before/after DemoWeb.Endpoint. The error most likely is induced by the internal attempt to use it before it has been started. Commented Apr 14, 2021 at 12:11
  • @AlekseiMatiushkin tried this too... not working Commented Apr 15, 2021 at 7:45

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.