Issue connecting to postgres on AWS SAM?
Sep 21, 2020
š¤ Problem
I'm trying to connect my lambda to a local instance of postgres. However, I'm getting the following error.
{
Error: connect ECONNREFUSED 127.0.0.1:5432
...
...
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 5432
}
ā Solution
I resolved this issue by replacing localhost with host.docker.internal
.

I'm Wes. I live in Boston and work on Wonderment.