0

App Engine connection to PostgreSQL Database suddenly lost

My App Engine connection to its CloudSQL Database doesn't work anymore. Till yesterday (26/08/2020) I was able to use my App Engine website normally. Suddenly something has changed and it says "SQLSTATE[08006] [7] could not connect to server: Connection refused Is the server running on host "127.0.0.1" and accepting TCP/IP connections on port 5432?"

I have to say that I never set up the App Engine application to connect to Database through port 5432. I can show you my current app.yaml configuration regarding DB connection:

beta_settings:
  cloud_sql_instances: "beecoms:europe-west3:beecoms-db"
  
env_variables:
[omissis]
  DB_CONNECTION: pgsql
  DB_HOST: "/cloudsql/PROJECTID:beecoms-db"

It used to work fine. I traced back my app engine versions in the Google Cloud Platform Debugger and I found one that works well: one functions as usual, although it's a bit outdated, the current one has trouble connecting to DB.

I tried looking into the old one's files to see if app.yaml, or .env or some laravel's config file in config folder was different from my current version, but I cannot find any difference.

I should also add that from my local machine I can still access to the database using cloud_sql_proxy, so it's not a CloudSQL server problem, I believe it's something in the connection between App Engine and CloudSQL

How can I restore my App Engine's connection to its CloudSQL database?

Greetings, Riccardo

Ajordat
  • 135
  • 5

1 Answers1

0

Solved it: it was actually Laravel's cache.

If it happens to you make sure to run

php artisan config:cache

Also, make sure you don't upload Laravel's cache to GCloud server in the first place!