Skip to content

Problem connecting to a Ligthsail managed PostgresQL database

0

I am trying to connect wix site to my postgres database so i can make some integrations. I followed this guide 'https://dev.wix.com/docs/develop-websites/articles/databases/external-databases/aws/integrate-your-aws-databases-with-your-wix-site' since it was the closest i found (no specific guide for a lightsail or custom db).

After setting all up i got this messages ' DB Config Status External DB Config read successfully

Permissions Config Status Permissions config not defined, using default

Connection Status Unrecognized Error: 28000, no pg_hba.conf entry for host "THE_IP_ADDRESS_OF_MY_APP_RUNNER_SERVICE", user "MY_USER", database "postgres", no encryption ' The Connection Status is the problem that I need to solve.

When I tried to see how to solve the 'Connection Status' error it either requires having a superuser in the db or access to the 'pg_hba.conf' file, which I have neither from the lightsail console, and the Networking menu only lets you select from public or private (i tried setting the DB as public and it didn't worked either). Anyone has any ideas how I might solve this, I was thinking on creating an API specific for the wix site, but i wanted to avoid this, it would be much better if i could grant read-write access to my Wix site.

Thanks.

asked 2 years ago977 views
2 Answers
1
Accepted Answer

Hello.

If the status is yellow, I think there is no problem.
The document you shared says.
https://dev.wix.com/docs/develop-websites/articles/databases/external-databases/aws/integrate-your-aws-databases-with-your-wix-site

The following page displays DB Config Status and Connection Status in green. If you added a PERMISSIONS secret, the Permissions Config Status is also green. If you didn't, it's yellow.

I think that if you wanted the status to be green, you would need to configure the "Learn more about configuring database permissions" section of the documentation.

EXPERT
answered 2 years ago
EXPERT
reviewed 2 years ago
  • Thanks, my problem is with the connection status that is red. 'Connection Status Unrecognized Error: 28000, no pg_hba.conf entry for host "THE_IP_ADDRESS_OF_MY_APP_RUNNER_SERVICE", user "MY_USER", database "postgres", no encryption ''. I did will update the question so it is clearer

  • Thanks, that it is what I was thinking, but my problem is with the 'Connection Status Unrecognized Error'. I will update my question so its clearer.

  • Thanks Riku, now its working properly.

1

I found out the cause.
The Lightsail DB instance parameter "rds.force_ssl" was set to 1.
If you change this to 0 using the command below and restart Lightsail DB, you can now connect.
https://docs.aws.amazon.com/lightsail/latest/userguide/amazon-lightsail-updating-database-parameters.html

aws lightsail update-relational-database-parameters --relational-database-name Database-3 --parameters "parameterName=rds.force_ssl,parameterValue=0,applyMethod=pending-reboot"

a

EXPERT
answered 2 years ago
EXPERT
reviewed 2 years ago
  • The values ​​registered in the secret manager are as follows.

    {"username":"dbmasteruser","password":"3uyyyyyyyyyyyyyy","engine":"postgres","host":"ls-yyyyyyyyyyyyyyyyy.yyyyyyyyyyyy.ap-northeast-1.rds.amazonaws.com","port":"5432","dbname":"postgrestutorial","SECRET_KEY":"myBigSecret","DB":"postgrestutorial"}
    

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.