简体   繁体   中英

no pg_hba.conf, just will not work. I have located and tried changing it many times

I have no pg_hba.conf error with Heroku Postgres. I have searched all over especially on here and tried many of the users suggestions. I have tried changing the pg_hba.conf file to pretty much all the different settings that a lot of the users on here have suggested, with no luck. My database is returning the correct info and still I can't get my app to work.

the error is:

2021-03-09T15:58:42.393656+00:00 app[web.1]: error: no pg_hba.conf entry for host "34.203.11.205", user "XXX", database "XXX", SSL off
2021-03-09T15:58:42.393667+00:00 app[web.1]: at Parser.parseErrorMessage (/app/node_modules/pg-protocol/dist/parser.js:278:15)
2021-03-09T15:58:42.393667+00:00 app[web.1]: at Parser.handlePacket (/app/node_modules/pg-protocol/dist/parser.js:126:29)
2021-03-09T15:58:42.393668+00:00 app[web.1]: at Parser.parse (/app/node_modules/pg-protocol/dist/parser.js:39:38)
2021-03-09T15:58:42.393668+00:00 app[web.1]: at Socket.<anonymous> (/app/node_modules/pg-protocol/dist/index.js:10:42)
2021-03-09T15:58:42.393669+00:00 app[web.1]: at Socket.emit (events.js:315:20)
2021-03-09T15:58:42.393670+00:00 app[web.1]: at addChunk (internal/streams/readable.js:309:12)
2021-03-09T15:58:42.393670+00:00 app[web.1]: at readableAddChunk (internal/streams/readable.js:284:9)
2021-03-09T15:58:42.393670+00:00 app[web.1]: at Socket.Readable.push (internal/streams/readable.js:223:10)
2021-03-09T15:58:42.393671+00:00 app[web.1]: at TCP.onStreamRead (internal/stream_base_commons.js:188:23) {
2021-03-09T15:58:42.393672+00:00 app[web.1]: length: 167,
2021-03-09T15:58:42.393673+00:00 app[web.1]: severity: 'FATAL',
2021-03-09T15:58:42.393673+00:00 app[web.1]: code: '28000',
2021-03-09T15:58:42.393673+00:00 app[web.1]: detail: undefined,
2021-03-09T15:58:42.393674+00:00 app[web.1]: hint: undefined,
2021-03-09T15:58:42.393674+00:00 app[web.1]: position: undefined,
2021-03-09T15:58:42.393675+00:00 app[web.1]: internalPosition: undefined,
2021-03-09T15:58:42.393676+00:00 app[web.1]: internalQuery: undefined,
2021-03-09T15:58:42.393676+00:00 app[web.1]: where: undefined,
2021-03-09T15:58:42.393676+00:00 app[web.1]: schema: undefined,
2021-03-09T15:58:42.393676+00:00 app[web.1]: table: undefined,
2021-03-09T15:58:42.393677+00:00 app[web.1]: column: undefined,
2021-03-09T15:58:42.393677+00:00 app[web.1]: dataType: undefined,
2021-03-09T15:58:42.393678+00:00 app[web.1]: constraint: undefined,
2021-03-09T15:58:42.393678+00:00 app[web.1]: file: 'auth.c',
2021-03-09T15:58:42.393678+00:00 app[web.1]: line: '496',
2021-03-09T15:58:42.393679+00:00 app[web.1]: routine: 'ClientAuthentication'
2021-03-09T15:58:42.393679+00:00 app[web.1]: }
2021-03-09T15:58:42.394559+00:00 heroku[router]: at=info method=GET path="/api/questions" host=my-new-quiz.herokuapp.com request_id=065c82c8-8fce-43e8-a877-136e97d3f596 fwd="188.223.116.76" dyno=web.1 connect=0ms service=13ms status=500 bytes=289 protocol=https

My pg_hba.conf file is:

# TYPE  DATABASE        USER            ADDRESS                 METHOD
# "local" is for Unix domain socket connections only
local   all             all                                  trust
# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
# IPv6 local connections:
host    all             all             ::1/128                 trust
Allow replication connections from localhost, by a user with the
replication privilege.
local   replication     all                                     trust
host    replication     all             127.0.0.1/32            trust
host    replication     all             ::1/128                 trust

I have added:

host all all 192.168.0.0/24 trust/md5 -- no luck
host all all 0.0.0.0/0 trust/md5 --- no luck
host (database info) (user info) (ip address) trust/md5 -- no luck
local all all 0.0.0.0/0 trust/md5 -- no luck

I have change the Postgresql.conf file to have #listen_addresses = '*'

I have tried to change the connection string to have ssl: true

Can someone please help, it works in development mode, just not when I upload to heroku.

my git repo is: https://github.com/jamesgill11/quiz-server.git

just remember, PostgreSQL does not lie:p

For IPv4 you only have

# IPv4 local connections:
host    all             all             127.0.0.1/32            trust

Means, you only expect local connections. Just add the scope for the IP "34.203.11.205"

for example:

host    all             all             34.203.11.205/32            md5

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM