I have a VM instance (e2-micro) on GCP running with postgres. I added my own external ip address to pg_hba.conf
so I can connect to the database on my local machine. Next to that I have a nodeJS application which I want to connect to that database. Locally that works, the application can connect to the database on the VM instance. But when I deploy the app to GCP I get a 500 Server Error when I try to visit the page in the browser.
These are the things I already did/tried:
app.yaml
If I allow all ip addresses on my VM instance with 0.0.0.0/0
then App Engine can connect, so my guess is that I'm doing something wrong the connector? I use 10.8.0.0/28
as ip range while the internal ip address of the VM instance is 10.132.0.2
, is that an issue? I tried an ip range with 10.0.0.0
but that also didn't work.
This answer pointed me in the right direction: https://stackoverflow.com/a/64161504/3323605.
I needed to deploy my app with
gcloud beta app deploy
since the VPC connector method was on beta. Also, I tried to connect to the external IP in my app.yaml
but that needed to be the internal IP ofcourse.