Can't connect to MySQL Cloud Instance from an other App Engine

917 wyświetleń
Przejdź do pierwszej nieodczytanej wiadomości

Vanessa Pasque

nieprzeczytany,
16 kwi 2019, 09:30:5916.04.2019
do Google Cloud SQL discuss
Hello,

I've 2 projects deployed on GCP (App Engine) :
- Back-office instance
- API Instance with Cloud MySQL Instance

The API can connect to MySQL without problem via the private IP, database name, username and password.

But my other app (Back-office) can't access to the MySQL Instance.

I've follow many example, tutorials...
1/ I've added IAM rights : backoffice have both "Client Cloud SQL" and "Éditeur Cloud SQL"
2/ I've enable all API necessary (Cloud SQL, App engine...) in both projects
3/ I've try flexible and standard environment
4/ I've add a public IP in backoffice and i've add it to MySQL connection 
5/ I used SocketPath for my Apps with Sequelize
6/ I've try both port "3306" and "3307" (why 3307 ? but I've found it in the Google Docs)

So... how can I connect the BackOffice to my Cloud MySQL Instance ?

Thanks for your help !

Katayoon (Cloud Platform Support)

nieprzeczytany,
16 kwi 2019, 15:15:0116.04.2019
do Google Cloud SQL discuss
Hi Vanessa,

I recommend to take the steps mentioned in this guideline. If you would like to test your app locally, you should set up your local environment and use the TCP port 3306 to connect from the proxy to the Cloud SQL instance. 

Once you deploy your app on App Engine, your app uses the Cloud SQL Proxy that is built in to the App Engine runtime environment to communicate with your Cloud SQL instance.

If your App Engine app is located in another project that your Cloud SQL instance resides, you should consider these additional steps as well. Note that you should grant "Cloud SQL Admin" role to the App Engine default service account too. 

Vanessa Pasque

nieprzeczytany,
16 kwi 2019, 23:21:2816.04.2019
do Google Cloud SQL discuss
Hi Katayoon,

Thanks for your reply. But, I've already do all that :(

I can access to my Cloud SQL Instance from local with proxy.
I can access to my Cloud SQL Instance from the App Engine locate on the same GCP Project.
I've add all necessary rights to the other App Engine project (Cloud SQL Admin), but I've still the error : 

[forest] 🌳🌳🌳  Unexpected error: connect ECONNREFUSED 127.0.0.1:3306
2019-04-16 13:54:24 default[20190416t131513]  SequelizeConnectionRefusedError: connect ECONNREFUSED 127.0.0.1:3306    
 

Configuration IAM on Project-A with Cloud SQL Instance :
App Engine default service account
Administrateur de Cloud SQL

List of all API enabled and used on Project B

Screenshot 2019-04-17 at 00.07.37.png























Have you any other ideas ?

Thank you,

Katayoon (Cloud Platform Support)

nieprzeczytany,
17 kwi 2019, 18:08:0417.04.2019
do Google Cloud SQL discuss
Hi Vanessa,

It seems the issue would be with your code using Sequelize. I recommend to post your full detailed question along with the code snippet you are using to Stack Overflow, using the supported Cloud tags, since Google Groups are reserved for general discussions on Google Cloud Platform-end products and not for technical questions. 
Odpowiedz wszystkim
Odpowiedz autorowi
Przekaż
Nowe wiadomości: 0