In my case psql/pg failed to connect and printed in error text that host 'localhost' was actually
::1
(not 127.0.0.1 or 0.0.0.0). After I changed "localhost" to "::1" in .env (or Pool constructor) - all worked fine.