Error connecting to local Postgres instance as destination in Airbyte Docker container


The user is facing an issue while trying to set up a destination connector in Airbyte Docker container to sync data between a local Postgres instance and a Typesense instance running in a container. The error message indicates a connection refusal to localhost:5432. User has tried using ‘localhost’ and ‘’ as the hostname but the issue persists.


I am trying to implement a task where I have to sync data between postgres instance running on my local machine, and typesense instance running in a container on my machine.
I am using Airbyte through a docker container. I have successfully setup the source, but failing to add the destination, which is typesense. I have several time tried to resolve the issue but getting this error “State code: 08001; Message: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.”
I have tried putting up the localhost name “localhost” and aslo “”, but failed to resolve this issue. Can you please help?
Hassaan Moeed

This topic has been created from a Slack thread to give it more visibility.
It will be on Read-Only mode here. Click here if you want to access the original thread.

Join the conversation on Slack

["airbyte", "docker-container", "postgres-instance", "typesense", "destination-connector", "connection-error"]

Hi Hassaan, Based on the information provided, it seems like you’re having trouble connecting to your local Postgres instance via Airbyte. Here are a few suggestions that might help: 1. Check your Postgres instance: Ensure that your Postgres instance is running and accepting connections on localhost:5432. You can verify this by connecting to it using a Postgres client or command-line tool. 2. Check your Google Cloud SQL Proxy: If you’re using Google Cloud SQL Proxy, make sure it’s running correctly and forwarding connections to your Postgres instance. You mentioned that you’ve tried running it on a different port than 5432, but the issue persists. It might be worth checking the proxy’s logs for any error messages. 3. Check your Airbyte configuration: In your .env file, make sure you’ve correctly set the DATABASE_USER, DATABASE_PASSWORD, DATABASE_HOST, DATABASE_PORT, and DATABASE_DB variables. If you’re using localhost to refer to the host machine from within a Docker container, you might need to use host.docker.internal instead, as suggested in this forum post. 4. Check your network settings: If Airbyte and your Postgres instance are running in different Docker networks, they might not be able to communicate with each other. You can try running them in the same network or configuring Docker to allow connections between networks. 5. Check Airbyte’s logs: If none of the above suggestions work, you can check Airbyte’s logs for more detailed error messages. This might give you more clues about what’s going wrong. If you’re still having trouble after trying these suggestions, you might find it helpful to consult the Airbyte documentation or ask for help on the Airbyte forum. Best,|

Postgres instance is working, but the typesense instance unable to connect

<@U06CY96N3B2> have you tried using host.docker.internal instead of localhost?

Yeah, Tried that too.

it ran the destination typesense container, but stopped after 2 secs

and then I got the error message in the logs

5432 is usually the port used for postgres, and in your screenshot it is listing 5432 as the port for postgres.

Maybe you should be using port 8108 in your typesense configuration instead, since that seems to be the port listed for that container in your screenshot?

heuristic spence is the container running typesense, it has 8108 port, and postgres has 5432, this is correct I guess.

Right, so your postgres source should use port 5432, and your typesense destination should use port 8108

it is set just like you mentioned

Traceback (most recent call last):
File “/airbyte/integration_code/”, line 11, in <module>
File “/usr/local/lib/python3.9/site-packages/airbyte_cdk/destinations/”, line 119, in run
for message in output_messages:
File “/usr/local/lib/python3.9/site-packages/airbyte_cdk/destinations/”, line 109, in run_cmd
yield self._run_check(config=config)
File “/usr/local/lib/python3.9/site-packages/airbyte_cdk/destinations/”, line 32, in _run_check
check_result = self.check(logger, config)

This is the error in stacktrace

Hmm but the error in your original post was
State code: 08001; Message: Connection to localhost:5432 refused
which seems to imply that you were setting the port for typesense to 5432

I’m also getting that same typesense destination error on the cloud. Seems to be a bug in the typesense destination code

<@U02T7NVJ6A3> can I share my screen and get the issue straight to you. Might be that I would’ve been making a mistake.

I’m running into this error when I try to set up a typesense destination on Airbyte Cloud:

Failure origin: destination
Failure type: system_error```
Is this the same error you are running into? I will raise this to the relevant team

Unfortunately, since this connector is a Community connector, it is not maintained by Airbyte, and therefore would need to be fixed by a contribution from the community.

You can find our connector support level guidelines|here

I see. Ty <@U02T7NVJ6A3> I will discuss that with my team.