连接被Heroku postgresql db通过节点拒绝

我正在通过节点在heroku上运行postgresql数据库。 我有我的服务器设置发布到'/提交',它调用数据库控制器将数据插入到数据库中。 一切工作在本地成功,但是当我部署到heroku和POST,我在我的heroku日志中出现以下错误。

2013-01-21T20:23:43+00:00 heroku[router]: at=info method=POST path=/submit host=[MYDOMAIN].herokuapp.com fwd=[IP] dyno=web.1 queue=0 wait=5ms connect=17ms service=35ms status=200 bytes=2 2013-01-21T20:23:46+00:00 app[web.1]: ^ 2013-01-21T20:23:46+00:00 app[web.1]: node.js:201 2013-01-21T20:23:46+00:00 app[web.1]: throw e; // process.nextTick error, or 'error' event on first tick 2013-01-21T20:23:46+00:00 app[web.1]: 2013-01-21T20:23:46+00:00 app[web.1]: at Object.afterConnect [as oncomplete] (net.js:637:18) 2013-01-21T20:23:46+00:00 app[web.1]: Error: connect ECONNREFUSED 2013-01-21T20:23:46+00:00 app[web.1]: at errnoException (net.js:646:11) 2013-01-21T20:23:48+00:00 heroku[web.1]: Process exited with status 1 

和应用程序中的503。

这是相关的控制器代码(在coffeescript中)。

 LOCAL_DB = "postgres://localhost:#{DBNAME}" connect = -> db = process.env.DATABASE_URL or LOCAL_DB client = new pg.Client client.connect() client insert = (options) -> client = connect() query = client.query "INSERT INTO #{TABLE} VALUES($1, $2, $3, $4);", [options.uid, options.ls_pref, options.hp_pref, options.date] query.on "error", onError query.on "end", -> client.end() 

我没有将我的数据库升级到DATABASE_URL:

 $ heroku config | grep DATABASE_URL > DATABASE_URL: postgres://[URL] 

为什么我的连接被拒绝?

事实certificate,我没有通过创build客户端时的数据库string。

 # Yes db = process.env.DATABASE_URL or LOCAL_DB client = new pg.Client db client.connect() # No db = process.env.DATABASE_URL or LOCAL_DB client = new pg.Client client.connect db 

当地数据库正在工作,尽pipe这是相当明显的疏忽。 你已经被警告!