When I try to open postgraphile UI it's not working. I'm getting the following error.
A serious error occurred when building the initial schema. Exiting because
retryOnInitFailis not set.Error: Connection terminated unexpectedly
at Connection. (D:\cars-assignment\node_modules\pg\lib\client.js:132:73)
at Object.onceWrapper (events.js:421:28)
at Connection.emit (events.js:315:20)
at Socket. (D:\cars-assignment\node_modules\pg\lib\connection.js:108:12)
at Socket.emit (events.js:327:22)
at endReadableNT (_stream_readable.js:1201:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
I'm using the following command
npx postgraphile -c postgres://username:SECRET@localhost:5000/db
How to resolve this issue?
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!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With