Docs: Get Started fails because Postgrex Protocol fails to connect

Open
#2,889 4 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
52/100
Issue type
Documentation
Clarity
Needs clarification
Activity status
Active
Tech stack
elixir, postgresql

Research direction

Start with the linked Get Started section, especially “Try our first resource out,” and reproduce the issue with iex -S mix after reviewing the shown ticket.ex, support.ex, and config/config.exs steps. Determine what setup guidance is missing for the Postgrex connection and verify that the documented flow reaches the IEx prompt without repeated connection errors.

Written by the indexing model from the issue text.

Description

bug
Code of Conduct
  • I agree to follow this project's Code of Conduct
AI Policy
  • I agree to follow this project's AI Policy, or I agree that AI was not used while creating this issue.
Versions

elixir 1.20.3-otp-29
erlang 29.0.5

mix deps

  • ash 3.32.0 (Hex package) (mix)
    locked at 3.32.0 (ash) ee80eeac
    ok
  • ash_phoenix 2.3.24 (Hex package) (mix)
    locked at 2.3.24 (ash_phoenix) 46e3209c
    ok
  • bandit 1.12.5 (Hex package) (mix)
    locked at 1.12.5 (bandit) c5684ca0
    ok
  • crux 0.1.4 (Hex package) (mix)
    locked at 0.1.4 (crux) ff7d880c
    ok
  • daisyui (https://github.com/saadeghi/daisyui.git - v5.5.20)
    locked at 22ecff5 (tag: v5.5.20)
    ok
  • db_connection 2.10.2 (Hex package) (mix)
    locked at 2.10.2 (db_connection) 510b1448
    ok
  • decimal 3.1.1 (Hex package) (mix)
    locked at 3.1.1 (decimal) c5f25f2c
    ok
  • dns_cluster 0.2.0 (Hex package) (mix)
    locked at 0.2.0 (dns_cluster) ba6f1893
    ok
  • ecto 3.14.2 (Hex package) (mix)
    locked at 3.14.2 (ecto) 25d60b8c
    ok
  • ecto_sql 3.14.0 (Hex package) (mix)
    locked at 3.14.0 (ecto_sql) f4d8d36f
    ok
  • esbuild 0.10.0 (Hex package) (mix)
    locked at 0.10.0 (esbuild) 468489cd
    ok
  • ets 0.9.0 (Hex package) (mix)
    locked at 0.9.0 (ets) 2861fdfb
    ok
  • ex_ast 0.13.1 (Hex package) (mix)
    locked at 0.13.1 (ex_ast) bd15f68c
    ok
  • expo 1.1.1 (Hex package) (mix)
    locked at 1.1.1 (expo) 5fb308b9
    ok
  • file_system 1.1.1 (Hex package) (mix)
    locked at 1.1.1 (file_system) 7a15ff97
    ok
  • finch 0.23.0 (Hex package) (mix)
    locked at 0.23.0 (finch) 80e58d3f
    ok
  • gettext 1.0.2 (Hex package) (mix)
    locked at 1.0.2 (gettext) eab80550
    ok
  • glob_ex 0.1.12 (Hex package) (mix)
    locked at 0.1.12 (glob_ex) 2e2fac83
    ok
  • heroicons (https://github.com/tailwindlabs/heroicons.git - v2.2.0)
    locked at 0435d4c (tag: v2.2.0)
    ok
  • hpax 1.0.4 (Hex package) (mix)
    locked at 1.0.4 (hpax) afc7cb14
    ok
  • idna 7.1.0 (Hex package) (rebar3)
    locked at 7.1.0 (idna) 6ae959a0
    ok
  • igniter 0.8.3 (Hex package) (mix)
    locked at 0.8.3 (igniter) afc5e384
    ok
  • iterex 0.1.2 (Hex package) (mix)
    locked at 0.1.2 (iterex) 2e103b8b
    ok
  • jason 1.4.5 (Hex package) (mix)
    locked at 1.4.5 (jason) b0c82399
    ok
  • mime 2.0.7 (Hex package) (mix)
    locked at 2.0.7 (mime) 6171188e
    ok
  • mint 1.9.3 (Hex package) (mix)
    locked at 1.9.3 (mint) 5f7c9342
    ok
  • multigraph 0.16.1-mg.4 (Hex package) (mix)
    locked at 0.16.1-mg.4 (multigraph) b9f3e257
    ok
  • nimble_options 1.1.1 (Hex package) (mix)
    locked at 1.1.1 (nimble_options) 821b2470
    ok
  • nimble_pool 1.1.0 (Hex package) (mix)
    locked at 1.1.0 (nimble_pool) af2e4e6b
    ok
  • owl 0.13.1 (Hex package) (mix)
    locked at 0.13.1 (owl) 351e768a
    ok
  • phoenix 1.8.12 (Hex package) (mix)
    locked at 1.8.12 (phoenix) e33bebd0
    ok
  • phoenix_ecto 4.7.0 (Hex package) (mix)
    locked at 4.7.0 (phoenix_ecto) 1d75011e
    ok
  • phoenix_html 4.3.0 (Hex package) (mix)
    locked at 4.3.0 (phoenix_html) 3eaa290a
    ok
  • phoenix_live_dashboard 0.8.7 (Hex package) (mix)
    locked at 0.8.7 (phoenix_live_dashboard) 3a8625ca
    ok
  • phoenix_live_reload 1.7.0 (Hex package) (mix)
    locked at 1.7.0 (phoenix_live_reload) dc9f4427
    ok
  • phoenix_live_view 1.2.10 (Hex package) (mix)
    locked at 1.2.10 (phoenix_live_view) bcf9d648
    ok
  • phoenix_pubsub 2.2.0 (Hex package) (mix)
    locked at 2.2.0 (phoenix_pubsub) adc313a5
    ok
  • phoenix_template 1.0.4 (Hex package) (mix)
    locked at 1.0.4 (phoenix_template) 2c0c81f0
    ok
  • plug 1.20.3 (Hex package) (mix)
    locked at 1.20.3 (plug) be266aee
    ok
  • plug_crypto 2.2.0 (Hex package) (mix)
    locked at 2.2.0 (plug_crypto) 83a95744
    ok
  • postgrex 0.22.4 (Hex package) (mix)
    locked at 0.22.4 (postgrex) 4aae45a2
    ok
  • reactor 1.0.6 (Hex package) (mix)
    locked at 1.0.6 (reactor) e3f8fd8e
    ok
  • req 0.7.3 (Hex package) (mix)
    locked at 0.7.3 (req) 73b30303
    ok
  • rewrite 1.3.0 (Hex package) (mix)
    locked at 1.3.0 (rewrite) d111ac7f
    ok
  • sourceror 1.12.2 (Hex package) (mix)
    locked at 1.12.2 (sourceror) da37d3da
    ok
  • spark 2.7.2 (Hex package) (mix)
    locked at 2.7.2 (spark) adb323dd
    ok
  • spitfire 0.4.0 (Hex package) (mix)
    locked at 0.4.0 (spitfire) 7e5c6d15
    ok
  • splode 0.3.2 (Hex package) (mix)
    locked at 0.3.2 (splode) 08fd658f
    ok
  • stream_data 1.4.0 (Hex package) (mix)
    locked at 1.4.0 (stream_data) 2b0ee3a3
    ok
  • swoosh 1.27.1 (Hex package) (mix)
    locked at 1.27.1 (swoosh) 9e732f46
    ok
  • tailwind 0.5.1 (Hex package) (mix)
    locked at 0.5.1 (tailwind) c4e26302
    ok
  • telemetry 1.4.2 (Hex package) (rebar3)
    locked at 1.4.2 (telemetry) 928f6495
    ok
  • telemetry_metrics 1.1.0 (Hex package) (mix)
    locked at 1.1.0 (telemetry_metrics) e7b79e8d
    ok
  • telemetry_poller 1.3.0 (Hex package) (rebar3)
    locked at 1.3.0 (telemetry_poller) 51f18bed
    ok
  • text_diff 0.1.0 (Hex package) (mix)
    locked at 0.1.0 (text_diff) d1ffaaec
    ok
  • thousand_island 1.5.0 (Hex package) (mix)
    locked at 1.5.0 (thousand_island) 708923d4
    ok
  • websock 0.5.3 (Hex package) (mix)
    locked at 0.5.3 (websock) 6105453d
    ok
  • websock_adapter 0.6.0 (Hex package) (mix)
    locked at 0.6.0 (websock_adapter) 50021a85
    ok
  • yamerl 0.10.0 (Hex package) (rebar3)
    locked at 0.10.0 (yamerl) 346adb29
    ok
  • yaml_elixir 2.12.2 (Hex package) (mix)
    locked at 2.12.2 (yaml_elixir) e7c1b101
    ok
  • ymlr 5.1.6 (Hex package) (mix)
    locked at 5.1.6 (ymlr) b36d7c72
    ok
Operating system

Debian 13.6 (same problem with Ubuntu 24.04.4 LTS running in WSL)

Current Behavior

While working through the Get Started tutorial a problem arises in Try our first resource out.

iex starts and compiles lots of code. Then it repeats a Postgrex Protocol error message continuously. Eventually the iex prompt appears, but the Postgrex Protocol error messages continue.

joel@try-ash:~/helpdesk$ iex -S mix
Erlang/OTP 29 [erts-17.0.5] [source] [64-bit] [smp:12:1] [ds:12:1:10] [async-threads:1] [jit:ns]

[Compilation messages omitted]

[error] `inotify-tools` is needed to run `file_system` for your system, check https://github.com/rvoicilas/inotify-tools/wiki for more information about how to install it. If it's already installed but not be found, appoint executable file with `config.exs` or `FILESYSTEM_FSINOTIFY_EXECUTABLE_FILE` env.
[warning] Not able to start file_system worker, reason: {:error, :fs_inotify_bootstrap_error}
[warning] Could not start Phoenix live-reload because we cannot listen to the file system.
You don't need to worry! This is an optional feature used during development to
refresh your browser when you save files and it does not affect production.

[error] Postgrex.Protocol (#PID<0.411.0> ("db_conn_2")) failed to connect: ** (DBConnection.ConnectionError) tcp connect (localhost:5432): connection refused - :econnrefused
[error] Postgrex.Protocol (#PID<0.412.0> ("db_conn_3")) failed to connect: ** (DBConnection.ConnectionError) tcp connect (localhost:5432): connection refused - :econnrefused
[error] Postgrex.Protocol (#PID<0.413.0> ("db_conn_4")) failed to connect: ** (DBConnection.ConnectionError) tcp connect (localhost:5432): connection refused - :econnrefused
Interactive Elixir (1.20.3) - press Ctrl+C to exit (type h() ENTER for help)
[error] Postgrex.Protocol (#PID<0.410.0> ("db_conn_1")) failed to connect: ** (DBConnection.ConnectionError) tcp connect (localhost:5432): connection refused - :econnrefused
iex(1)> 
BREAK: (a)bort (A)bort with dump (c)ontinue (p)roc info (i)nfo
       (l)oaded (v)ersion (k)ill (D)b-tables (d)istribution
Reproduction

Working as user joel in a new Proxmox LXC container running Debian 13.6 ...

Install Erlang and Elixir

Install Erlang and Elixir prerequisites.

sudo apt-get install -y \
  build-essential autoconf automake libncurses-dev \
  libssl-dev   libwxgtk3.2-dev xsltproc fop libxml2-utils \
  unixodbc-dev default-jdk flex bison

Install and activate Mise

curl https://mise.run | sh
echo 'eval "$(~/.local/bin/mise activate bash)"' >> ~/.bashrc

Restart the shell session.

exec bash -l

Install Erlang and Elixir.

mise install erlang@latest && mise use erlang@latest
mise install elixir@latest && mise use elixir@latest

Check the installation.

mise doctor
mise ls
Follow the Get Started Tutorial

Install phx.new and igniter_new.

mix archive.install hex phx_new
mix archive.install hex igniter_new

Create a new Phoenix project.

mix igniter.new helpdesk --install ash,ash_phoenix --with phx.new

Copy code from Getting Started into ticket.ex and support.ex.

cd helpdesk
mkdir -p lib/helpdesk/support
cat > lib/helpdesk/support/ticket.ex
...
cat > lib/helpdesk/support.ex
...

Add this line to config/config.exs.

config :helpdesk, :ash_domains, [Helpdesk.Support]

Try out the first resource.

iex -S mix
Expected Behavior

Expected iex to compile code and present a prompt so I could continue the tutorial.

Dominant language
Elixir
Stars
2.6k
Forks
469
Avg merge
1d 37m
Merged PRs (30d)
45

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ash-project/ash

All issues in ash-project/ash

Similar issues

More Elixir issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.