Can't connect to Postgres data source

i have local grafana, and it is connected to the Local Postgres data source ( localhost:5432 )

iam trying to connect the online grafana dashboard to the same Local Postgres data source
with the same configuration.

it gives me the following error
[sqleng.connectionError] failed to connect to server - Please try again. If the issue persists please open a support ticket that notes the time in UTC.

i have tried to add 5432 port to the firewall to be allowed.

Appreciate your help

How are you trying to do that? By using localhost or a public ip address?