我的适配器看起来像这样 的配置/ connections.js
herokuPG: {
adapter: 'sails-postgresql',
url: 'process.env.DATABASE_URL',
pool: false,
ssl: false
}
的package.json
{
"name": "<omitted>",
"private": true,
"version": "0.0.0",
"description": "a Sails application",
"keywords": [],
"dependencies": {
"sails": "~0.10.0-rc5",
"sails-disk": "~0.10.0",
"rc": "~0.3.3",
"include-all": "~0.1.3",
"ejs": "~0.8.4",
"grunt": "0.4.2",
"grunt-sync": "~0.0.4",
"grunt-contrib-copy": "~0.5.0",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-concat": "~0.3.0",
"grunt-sails-linker": "~0.9.5",
"grunt-contrib-jst": "~0.6.0",
"grunt-contrib-watch": "~0.5.3",
"grunt-contrib-uglify": "~0.4.0",
"grunt-contrib-cssmin": "~0.9.0",
"grunt-contrib-less": "~0.10.0",
"grunt-contrib-coffee": "~0.10.1",
"sails-postgresql": "^0.10.0-rc4"
},
"scripts": {
"start": "node app.js",
"debug": "node debug app.js"
},
"main": "app.js",
"repository": {
"type": "git",
"url": "<ommited>"
},
"author": "harrymoreno",
"license": ""
}
错误
2014-06-25T09:20:20.696476+00:00 heroku[api]: Deploy 78d27cf by morenoh149@gmail.com
2014-06-25T09:20:20.696476+00:00 heroku[api]: Release v8 created by morenoh149@gmail.com
2014-06-25T09:20:25.206447+00:00 heroku[web.1]: Starting process with command `node app.js`
2014-06-25T09:20:28.317530+00:00 app[web.1]: Error creating a connection to Postgresql: Error: connect ECONNREFUSED
2014-06-25T09:20:28.319161+00:00 app[web.1]: error: Error: connect ECONNREFUSED
2014-06-25T09:20:28.321347+00:00 app[web.1]: at Object.afterConnect [as oncomplete] (net.js:895:19) Error: connect ECONNREFUSED
2014-06-25T09:20:28.319165+00:00 app[web.1]: at errnoException (net.js:904:11)
2014-06-25T09:20:28.319168+00:00 app[web.1]: at Object.afterConnect [as oncomplete] (net.js:895:19) Error: connect ECONNREFUSED
2014-06-25T09:20:28.321340+00:00 app[web.1]: error: Error: connect ECONNREFUSED
2014-06-25T09:20:28.321344+00:00 app[web.1]: at errnoException (net.js:904:11)
2014-06-25T09:20:28.318456+00:00 app[web.1]: error: A hook (`orm`) failed to load!
2014-06-25T09:20:29.597434+00:00 heroku[web.1]: State changed from starting to crashed
2014-06-25T09:20:29.598968+00:00 heroku[web.1]: State changed from crashed to starting
2014-06-25T09:20:29.587153+00:00 heroku[web.1]: Process exited with status 0
2014-06-25T09:20:36.247496+00:00 app[web.1]: error: A hook (`orm`) failed to load!
2014-06-25T09:20:36.248153+00:00 app[web.1]: error: Error: connect ECONNREFUSED
2014-06-25T09:20:36.250261+00:00 app[web.1]: at errnoException (net.js:904:11)
2014-06-25T09:20:36.250263+00:00 app[web.1]: at Object.afterConnect [as oncomplete] (net.js:895:19) Error: connect ECONNREFUSED
2014-06-25T09:20:36.243584+00:00 app[web.1]: Error creating a connection to Postgresql: Error: connect ECONNREFUSED
2014-06-25T09:20:36.250259+00:00 app[web.1]: error: Error: connect ECONNREFUSED
2014-06-25T09:20:36.248156+00:00 app[web.1]: at errnoException (net.js:904:11)
2014-06-25T09:20:36.248158+00:00 app[web.1]: at Object.afterConnect [as oncomplete] (net.js:895:19) Error: connect ECONNREFUSED
2014-06-25T09:20:33.439829+00:00 heroku[web.1]: Starting process with command `node app.js`
2014-06-25T09:20:37.580073+00:00 heroku[web.1]: Process exited with status 0
2014-06-25T09:20:38.452081+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=txtbinge-landing.herokuapp.com request_id=b3bee9ff-826d-46e7-9537-38e923740ba1 fwd="173.228.123.147" dyno= connect= service= status=503 bytes=
2014-06-25T09:20:38.804141+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=txtbinge-landing.herokuapp.com request_id=e24d1a2c-28d9-4155-b79c-32c05649e43a fwd="173.228.123.147" dyno= connect= service= status=503 bytes=
2014-06-25T09:20:37.591982+00:00 heroku[web.1]: State changed from starting to crashed
根据heroku docs我使用sails postgresql adapter
的0.10.x版本,我没有使用pg
模块
答案 0 :(得分:6)
在查看Heroku文档后,我找到了this。
所有连接都需要SSL:sslmode = require。
您需要将 ssl 设置为 true 。
herokuPG: {
adapter: 'sails-postgresql',
url: process.env.DATABASE_URL,
pool: false,
ssl: true
}