Phx 1.5 upgrade getting error: "failed to start child: Phoenix.PubSub.Supervisor"

Hi guys I can’t seem to fix this.

I’ve search this forum and google and couldn’t find the answer.

Thanks for your time.

Here’s the full error:

Generated fumigate app
** (Mix) Could not start application fumigate: Fumigate.Application.start(:normal, []) returned an error: shutdown: failed to start child: Phoenix.PubSub.Supervisor
    ** (EXIT) an exception was raised:
        ** (FunctionClauseError) no function clause matching in Access.get/3
            (elixir 1.10.2) lib/access.ex:284: Access.get(Fumigate.PubSub, :name, nil)
            (phoenix_pubsub 2.0.0) lib/phoenix/pubsub/supervisor.ex:6: Phoenix.PubSub.Supervisor.start_link/1
            (stdlib 3.12) supervisor.erl:379: :supervisor.do_start_child_i/3
            (stdlib 3.12) supervisor.erl:365: :supervisor.do_start_child/2
            (stdlib 3.12) supervisor.erl:349: anonymous fn/3 in :supervisor.start_children/2
            (stdlib 3.12) supervisor.erl:1157: :supervisor.children_map/4
            (stdlib 3.12) supervisor.erl:315: :supervisor.init_children/2
            (stdlib 3.12) gen_server.erl:374: :gen_server.init_it/2
            (stdlib 3.12) gen_server.erl:342: :gen_server.init_it/6
            (stdlib 3.12) proc_lib.erl:249: :proc_lib.init_p_do_apply/3

My mix.exs:

  40   defp deps do
  41     [
  42       {:phoenix, "~> 1.5.0", override: true},
  43       {:phoenix_pubsub, "~> 2.0"},
  44       {:phoenix_ecto, "~> 4.0"},
  45       {:ecto_sql, "~> 3.0"},
  46       {:postgrex, ">= 0.0.0"},
  47       {:phoenix_html, "~> 2.11"},
  48       {:phoenix_live_reload, "~> 1.2", only: :dev},
  49       {:gettext, "~> 0.11"},
  50       {:jason, "~> 1.0"},
  51       {:plug_cowboy, "~> 2.2"},
  52       {:ecto_enum, "~> 1.2"},
  53       {:scrivener_ecto, "~> 2.0"},
  54       {:edeliver, ">= 1.6.0"},
  55       {:distillery, "~> 2.0", warn_missing: false},
  56       {:credo, "~> 1.0.0", only: [:dev, :test], runtime: false},
  57       {:sobelow, "~> 0.7.6"},
  58       {:html_sanitize_ex, "~> 1.3"},
  59       {:scrivener_html, "~> 1.8"},
  60       {:comeonin, "~> 5.3"},
  61       {:bcrypt_elixir, "~> 2.0"},
  62       {:pow, "~> 1.0.4"},
  63       {:recaptcha, "~> 2.3"}
  64     ]

my config.exs:

  12 # Configures the endpoint
  13 config :fumigate, FumigateWeb.Endpoint,
  14   url: [host: "localhost"],
  15   secret_key_base: "supersecret",
  16   render_errors: [view: FumigateWeb.ErrorView, accepts: ~w(html json)],
  17   pubsub_server: Fumigate.PubSub

my application.ex:

   8   def start(_type, _args) do
   9     # List all child processes to be supervised
  10     children = [
  11       # Start the Ecto repository
  12       Fumigate.Repo,
  13       # Start the PubSub system
  14       {Phoenix.PubSub, Fumigate.PubSub},
  15       # Start the endpoint when the application starts
  16       FumigateWeb.Endpoint,
  17       # Starts a worker by calling: Fumigate.Worker.start_link(arg)
  18       # {Fumigate.Worker, arg},
  19     ]
  20

One thing I notice is that it didn’t add telemetry, phoenix live, etc… The phoenix live salt isn’t added in the config either during the upgrade process.

When I create a new project the mix file doesn’t include {:phoenix_pubsub, "~> 2.0"} where as all the upgrade tutorials (chris’s git and this one ) instruct to add it in your mix file.

Do note that I’m using {:plug_cowboy, "~> 2.2"}, for some compatibility reasons…

You have:

{Phoenix.PubSub, Fumigate.PubSub}

You need:

{Phoenix.PubSub, name: Fumigate.PubSub}

Then you should be all set!

1 Like

Thank you, sometime I wonder if I’m dyslexic.