Postresql没有连接到heroku

时间:2018-05-06 19:37:54

标签: javascript node.js error-handling node-modules heroku-postgres

即时通讯使用heroku来托管我的网站,但它不断吐出相同的错误

  

2018-05-06T19:28:52.212104 + 00:00 app [web.1]:AssertionError [ERR_ASSERTION]:false == true

     

2018-05-06T19:28:52.212106 + 00:00 app [web.1]:at Object.exports.connect(_tls_wrap.js:1036:3)

     

2018-05-06T19:28:52.212107 + 00:00 app [web.1]:在Socket。 (/app/node_modules/pg/lib/connection.js:94:23)

     

2018-05-06T19:28:52.212109 + 00:00 app [web.1]:at Object.onceWrapper(events.js:315:30)

     

2018-05-06T19:28:52.212110 + 00:00 app [web.1]:在emitOne(events.js:116:13)

     

2018-05-06T19:28:52.212112 + 00:00 app [web.1]:at Socket.emit(events.js:211:7)

     

2018-05-06T19:28:52.212113 + 00:00 app [web.1]:at addChunk(_stream_readable.js:263:12)

     

2018-05-06T19:28:52.212115 + 00:00 app [web.1]:在readableAddChunk(_stream_readable.js:250:11)

     

2018-05-06T19:28:52.212116 + 00:00 app [web.1]:at Socket.Readable.push(_stream_readable.js:208:10)

     

2018-05-06T19:28:52.212118 + 00:00 app [web.1]:at TCP.onread>>(net.js:607:20)

这是我如何连接(直接取自herokus网站)

const { Client } = require("pg");

const router = express.Router();

const pool = new Client({
    connectionString: process.env.DATABASE_URL,
    ssl: true,
});

pool.connect();

我发现错误是什么:

错误是我没有db创建。我决定使用elephantSQL和他们用pgadmin连接到elephantSQL并重新创建我的数据库。它现在完美无缺

了解其工作原理,请参阅:https://www.elephantsql.com/docs/pgadmin.html

我非常乐意回答一些问题

1 个答案:

答案 0 :(得分:0)

好的,这不是一个真正的解决方案,但它可能会帮助你。在节点8(和10)上发生这种情况,但当我降级到节点7时,似乎工作正常。我正在看这篇文章,看看是否有人想出更好的解决方案。