且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

与Docker进行集成测试期间的Postgres身份验证问题

更新时间:2023-02-14 14:23:47

尝试从主机将数据库与psql postgres://postgres:postgres@localhost:5432/database连接.如果这不起作用,则说明您的docker psql服务器有问题.当前测试连接的方式可能使用unix套接字来连接服务器,因此无法验证服务器是否通过TCP套接字接受连接.

Try to connect your database with psql postgres://postgres:postgres@localhost:5432/database from your host machine. If that does not work you have problem with your docker psql server. The way you are currently testing your connection might use unix sockets to connect the server, so it doesn't verify that your server is accepting connections through TCP socket.

如果与psql的TCP连接工作正常,请尝试打印出使用的knex配置,以确保没有undefined值传递给任何连接属性.首先,您应该尝试使用硬编码的参数进行连接,然后再尝试执行更复杂的操作.

If TCP connection with psql works fine, try to print out your used knex configurations to make sure there are no undefined values passed to any of connection attributes. First you should try to connect with hardcoded parameters, before trying to do anything more complicated.