我有一个使用react,redux,node和postgresql(knex)构建的应用程序,我可以将此应用程序部署到heroku。但是,在应用程序中对数据库的所有api请求都不起作用。它没有提取任何数据或我无法注册。
在应用程序中,我收到如下控制台错误:
Failed to load resource: the server responded with a status of 503 (Service Unavailable)
Uncaught (in promise) Error: Request failed with status code 503(…)
...
有没有办法解决这个问题? 我的knex配置:
module.exports = {
development: {
client: 'postgresql',
connection: {
database: 'database5',
user: 'user',
password: ''
},
pool: {
min: 2,
max: 10
},
migrations: {
tableName: 'knex_migrations'
}
},
staging: {
client: 'postgresql',
connection: {
database: 'my_db',
user: 'username',
password: 'password'
},
pool: {
min: 2,
max: 10
},
migrations: {
tableName: 'knex_migrations'
}
},
production: {
client: 'postgresql',
connection: process.env.DATABASE_URL,
pool: {
min: 2,
max: 10
},
migrations: {
tableName: 'knex_migrations'
}
}
};
heroku日志错误:
2016-10-25T13:06:04.647342+00:00 app[web.1]: Unhandled rejection Error: connect ECONNREFUSED 127.0.0.1:5432
2016-10-25T13:06:04.647361+00:00 app[web.1]: at Object.exports._errnoException (util.js:893:11)
2016-10-25T13:06:04.647362+00:00 app[web.1]: at exports._exceptionWithHostPort (util.js:916:20)