nikitas

nikitas

After updating with Erlang 24 I cannot start app because the function :pg2.create/1 is undefined or private. Here is the response I get after executing mix phx.server

** (Mix) Could not start application wui: Wui.Application.start(:normal, ) returned an error: shutdown: failed to start child: Wui.Endpoint
** (EXIT) shutdown: failed to start child: Phoenix.PubSub.PG2
** (EXIT) shutdown: failed to start child: Phoenix.PubSub.PG2Server
** (EXIT) an exception was raised:
** (UndefinedFunctionError) function :pg2.create/1 is undefined or private
(kernel 8.0) :pg2.create({:phx, Wui.PubSub})
(phoenix_pubsub 1.1.2) lib/phoenix/pubsub/pg2_server.ex:43: Phoenix.PubSub.PG2Server.init/1
(stdlib 3.15) gen_server.erl:423: :gen_server.init_it/2
(stdlib 3.15) gen_server.erl:390: :gen_server.init_it/6
(stdlib 3.15) proc_lib.erl:226: :proc_lib.init_p_do_apply/3

Any advice on how to proceed will be much appreciated. Thanks in advance.

Showing Posts 1 to 7

hauleth

hauleth

:pg2 was deprecated some time ago and was scheduled to be removed on OTP24. You probably need to update the dependency and recompile the phoenix_pubsub to compile time selection of the implementation.

nikitas

nikitas OP

Thanks for the reply. I am not sure how to proceed and whether I interpreted your suggestion correctly. I compiled phoenix_pubsub with mix deps.compile phoenix_pubsub and now this dependency as reported by mix deps is

  • phoenix_pubsub 1.1.2 (Hex package) (mix)
    locked at 1.1.2 (phoenix_pubsub) 1f13f9f0
    ok

I still get the same error though when I run mix phx.server.

josevalim

josevalim

Creator of Elixir

Yeah, updating Phoenix.PubSub to the latest should be enough to address the issue. The latest version is 2.0.0, so you will have to update your deps so you can bump to latest.

15
Post #3
nikitas

nikitas OP

Thanks a million guys. I updated phoenix to 1.5.9 and phoenix_pubsub to 2.0.0 and now everything works fine!

johns10davenport

johns10davenport

This did not fix me, probably because I have a direct :pg2 call in my Application code:

def start(_type, _args) do
    children = [
      UserDocs.Repo,
      UserDocs.Vault,
      {Phoenix.PubSub, name: UserDocs.PubSub, adapter: Phoenix.PubSub.PG2}
    ]

    :pg2.create(UserDocs.PubSub)
    Supervisor.start_link(children, strategy: :one_for_one, name: UserDocs.Supervisor)
  end

I believe this came in with the phoenix boilerplate. I’ll have to replace this with whatever is current.

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

You can simply remove that line. I don’t remember it being part of Phoenix but certainly these days it is not a necessary line.

axelson

axelson

Scenic Core Team

Additionally as part of the Phoenix 1.4.x → 1.5.0 upgrade you should change that line to:

{Phoenix.PubSub, name: UserDocs.PubSub}

Assuming you’re already on Phoenix 1.5.x (which you probably should be if you want to be using OTP 24) I would take a close look at the upgrade guide to ensure that you’re not missing any of the other steps: phx-1.5-upgrade.md · GitHub

— All posts loaded —

Where Next? Top

Trending in Questions Top

katta
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
achenet
Hello, I’m trying to build a basic Phoenix web-app, and I’d like to use Tailwind. However, when I launch mix phx.server, I get an error...
New
kpanic
Hi everyone, I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding. I sta...
New
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
Cxx-mlr
I’m working on a small exercise involving update_in/3, and I came up with this solution: data = %{ name: "Periodic Table", category:...
New
ChrisAmelia
I’ve got trouble wrapping my head around the order in which functions are called in this snippet (from Phoenix’s authentication): toke...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews