#node.js #postgresql #heroku #knex.js #heroku-postgres
#node.js #postgresql #heroku #knex.js #heroku-postgres
Вопрос:
я создаю приложение heroku с postgress, но получаю сообщение об ошибке «ТАКЖЕ ПРИ РАЗВЕРТЫВАНИИ», я использую knexjs для подключения к базе данных, вот мое соединение
import knex from 'knex'
const database = knex({
client: 'pg',
connection: process.env.DATABASE_URL,
})
const retrieve = async () => {
let users = await database.select().from('users')
return users
}
export default retrieve
полная ошибка
2021-02-02T22:31:25.531198 00:00 app[web.1]: (node:21) UnhandledPromiseRejectionWarning: error: no pg_hba.conf entry for host "0.0.0.0", user "abcdefghi", database abcdefg", SSL off
2021-02-02T22:31:25.531208 00:00 app[web.1]: at Parser.parseErrorMessage (/app/node_modules/pg-protocol/dist/parser.js:278:15)
2021-02-02T22:31:25.531209 00:00 app[web.1]: at Parser.handlePacket (/app/node_modules/pg-protocol/dist/parser.js:126:29)
2021-02-02T22:31:25.531211 00:00 app[web.1]: at Parser.parse (/app/node_modules/pg-protocol/dist/parser.js:39:38)
2021-02-02T22:31:25.531211 00:00 app[web.1]: at Socket.<anonymous> (/app/node_modules/pg-protocol/dist/index.js:10:42)
2021-02-02T22:31:25.531212 00:00 app[web.1]: at Socket.emit (events.js:314:20)
2021-02-02T22:31:25.531213 00:00 app[web.1]: at addChunk (_stream_readable.js:297:12)
2021-02-02T22:31:25.531214 00:00 app[web.1]: at readableAddChunk (_stream_readable.js:272:9)
2021-02-02T22:31:25.531214 00:00 app[web.1]: at Socket.Readable.push (_stream_readable.js:213:10)
2021-02-02T22:31:25.531215 00:00 app[web.1]: at TCP.onStreamRead (internal/stream_base_commons.js:188:23)
2021-02-02T22:31:25.531823 00:00 app[web.1]: (node:21) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 5)
2021-02-02T22:31:25.532056 00:00 app[web.1]: (node:21) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Комментарии:
1. 0.0.0.0 странно. Вы не пытаетесь установить свой
DATABASE_URL
, не так ли?2. на самом деле этого не было, я изменил его на 0.0.0.0