【发布时间】:2015-06-07 03:53:57
【问题描述】:
当我用 Auth0 连接 heroku postgres 数据库时,我遇到了错误。
could not connect to postgres db { [error: no pg_hba.conf entry for host "XXXXXXXX", user "XXXXXX", database "XXXXXX", SSL off]
name: 'error',
length: 161,
severity: 'FATAL',
code: '28000',
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: 'auth.c',
line: '496',
routine: 'ClientAuthentication' }
[error] 28000 - undefined
我正在使用 Auth0,所以请在下面找到带有 heroku 数据库详细信息和 URL 的 auth0 代码。
configuration.config_file = "postgres://username:password@host:port/DB_name"
function login (email, password, callback) {
var conString = configuration.config_file;
postgres(conString, function (err, client) {
if (err) {
console.log('could not connect to postgres db', err);
return callback(err);
}
});
}
【问题讨论】:
-
欢迎来到 Stackoverflow。如果您有任何错误消息,请发布。
-
您是否授予了适当的权限以允许访问您的数据库? pg_hba.conf 文件是访问权限,似乎您的服务器的 IP 未在此处列出或没有适当的权限。
-
@yakiklein 你能告诉我当我们使用 auth0 访问 heroku 数据库时如何授予权限吗?
-
看看我下面的回答。希望对您有所帮助。
-
@GauravGupta 你是如何解决这个问题的?
标签: ruby-on-rails ruby node.js heroku-postgres auth0