Node.js Heroku postgres数据库未连接
我在Heroku上玩,试图链接到postgres数据库。我的应用程序直接链接到github源代码。当我使用Heroku DB凭据和npm start在本地运行它时,它可以工作,但在部署它时却不能工作,我遇到了以下错误:Node.js Heroku postgres数据库未连接,node.js,postgresql,heroku,Node.js,Postgresql,Heroku,我在Heroku上玩,试图链接到postgres数据库。我的应用程序直接链接到github源代码。当我使用Heroku DB凭据和npm start在本地运行它时,它可以工作,但在部署它时却不能工作,我遇到了以下错误: {"name":"SequelizeConnectionError","message":"password authentication failed for user \"riunhwzbjuwwgw\"","parent": {"name":"error","length"
{"name":"SequelizeConnectionError","message":"password authentication failed for user \"riunhwzbjuwwgw\"","parent":
{"name":"error","length":103,"severity":"FATAL","code":"28P01","file":"auth.c","line":"285","routine":"auth_failed"},"original":
{"name":"error","length":103,"severity":"FATAL","code":"28P01","file":"auth.c","line":"285","routine":"auth_failed"}}
有什么想法吗
编辑:这里是连接
var sequelize = new Sequelize(config.db.dbName, config.db.username, config.db.password, {
host: config.db.host,
dialect: config.db.dialect,
port: config.db.port,
dialectOptions: {
ssl: true
},
logging : false
});
还有我的变量
db: {
dbName: process.env.DBNAME,
username : process.env.DBUSER,
password : process.env.DBPASSWORD,
host : process.env.DBHOST,
dialect: "postgres",
port : 5432
}
就像我说的,它在本地起作用。密码设置类似于DBUSER riunhwzbjuwwgw,可能是那些斜杠\“riunhwzbjuwwwgw\”说明非常清楚-密码错误。您可以在尝试连接到数据库的位置共享代码吗?这可能需要调用
newsequelize(…)
。“很可能是出了什么问题。”DavidRunger更新了查看您的Heroku面板。可能当您设置ENV vars时,您添加了不必要的字符(如开头或结尾的空格)@TomaszJakubRup开头的空格,thx