I think there is more to the error output than @deluxan is showing. At least there is for me. I think the problem is that postgraphile is ignoring the port specified in the connection string. First, I have PostgreSQL running in a Docker container exposed on port 5555.
17502bafdf52 exspda_postgis "docker-entrypoint.s…" 2 months ago Up 5 minutes 0.0.0.0:5555->5432/tcp exspda_postgis
Then when I attempt to run Postgraphile via Docker...
$ docker run --init -p 5000:5000 graphile/postgraphile --connection postgres://hippo:mypassword@localhost:5555/first_geo --schema public --watch
...the full output is:
PostGraphile v4.12.1 server listening on port 5000
‣ GraphQL API: http://0.0.0.0:5000/graphql
‣ GraphiQL GUI/IDE: http://0.0.0.0:5000/graphiql (RECOMMENDATION: add '--enhance-graphiql')
‣ Postgres connection: postgres://hippo:[SECRET]@localhost/first_geo (watching)
‣ Postgres schema(s): public
‣ Documentation: https://graphile.org/postgraphile/introduction/
‣ Node.js version: v12.22.1 on linux x64
‣ Join Storyscript in supporting PostGraphile development: https://graphile.org/sponsor/
* * *
A serious error occurred when building the initial schema. Exiting because `retryOnInitFail` is not set. Error details:
Error: connect ECONNREFUSED 127.0.0.1:5432
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1144:16)
The output Postgres connection: postgres://hippo:[SECRET]@localhost/first_geo
does not include the port I specified in the connection string. The actual error also appears to show that the port I specified is not used: Error: connect ECONNREFUSED 127.0.0.1:5432
. It is trying to use port 5432 when I specified 5555. I suspect this is the same thing that @deluxan experienced. Is port 5432 hard-coded in postgraphile? How can it be fixed to recognize the port specified in the user-provided connection string?
Please note that I am brand new to Postgraphile so my apologies for silly (i.e., obvious to others) oversights and mistakes!