My Netlify Functions won't connect to an Aurora RDS

PSite name: https://dev--benchmarkprofessional.netlify.app

I’m currently trying to connect my lambda functions to an AWS Aurora Serverless (PotgreSQL) database and it can’t find the cluster. I do tests from local and everything works correctly.

Attached image of the error, the cluster is on and accepts connections from the internet

image

Hi, @dcadenaallan. Are you making that host and port available to public internet connections? I ask because I cannot connect to that host and port when I test:

$ sudo nmap -Pn -sS -T2 -p 5432 database-1.cluster-cjcxflnltzn2.us-east-1.rds.amazonaws.com
Starting Nmap 7.92 ( https://nmap.org ) at 2022-05-31 23:17 PDT
Nmap scan report for database-1.cluster-cjcxflnltzn2.us-east-1.rds.amazonaws.com (54.165.75.161)
Host is up.
rDNS record for 54.165.75.161: ec2-54-165-75-161.compute-1.amazonaws.com

PORT     STATE    SERVICE
5432/tcp filtered postgresql

Nmap done: 1 IP address (1 host up) scanned in 2.60 seconds

This shows the port is closed (aka “filtered”). That explains why the instance cannot connect to it. You will need to open that port to allow your function to make the connection.

If there are other questions about this, please let us know.

1 Like

Hi @luke

I had the DB turned off, I already turned it on.

Regarding that if I have it open to connections from the internet, the answer is yes. Working on my pc everything works correctly, the problem is when I do the deployment in netlify.

Hi @dcadenaallan,

It still appears that the DB is turned off or at least not accessible. If you could, please run the following Netcat command when the DB is up and let us know your results:

nc -zv database-1.cluster-cjcxflnltzn2.us-east-1.rds.amazonaws.com 5432

1 Like

Hi @Melvin
This is the output I get when I run the command

I will leave the DB turned on so it is easy for you to test against it. Let me know if there is anything else I can do to help

Kind regards

Hey there, @dcadenaallan :wave:

Thanks for following up here. I took a look at your function logs yesterday and am seeing that everything is running as expected, and I am not seeing any errors. Additionally, in the message you share above I see succeeded! at the end. If you are still encountering obstacles, can you please elaborate on what they are? Additionally, can you provide a reproduction?

The problem still occurs and you can see it in the “DEV” branch, that’s why the site I put when starting support is “https://dev--benchmarkprofessional.netlify.app”.