Hello Emanuel, 

Even though it requires project ids and Cloud SQL instance name to 
investigate the issue further, on a best effort basis I have done some 
research.

If I have understood it correctly you have MySQL database at projectA and 
App Engine application at projectB.

In that case I believe you have not done the permission part correctly as 
described by third party in this StackOverflow thread 
<https://stackoverflow.com/a/23522193>. As described at the StackOverflow 
thread <https://stackoverflow.com/a/23522193>, you need to go to the Cloud 
SQL Console and Click Edit. After that you need to select “Connections” 
from the left menu and need to add the Project where App Engine application 
is located following the instructions outlined at Console. In this case the 
Project is projectB. 

So after going to projectB, you need to select the App Engine default 
service account which will be “[email protected]”. After 
that you need to add the “[email protected]” at projectA 
with the role “Cloud SQL Client” as described at the StackOverflow thread 
<https://stackoverflow.com/a/42827972>. 

In addition to that in this StackOverflow thread, 
<https://stackoverflow.com/questions/52756897/unable-to-connect-to-cloud-sql-from-different-project-on-app-engine-flex-java>it
 
is suggested by a third party to enable both Cloud SQL API and the Cloud 
SQL Admin API in both projects. 

If still the issue is not resolved or If you have any technical queries or 
think your issue is related to code, you can post at the Stack Overflow 
<https://stackoverflow.com/> or Server Fault <https://serverfault.com/> and 
a community of developers will assist you.

In case there are any technical issues or you would like to request any 
feature you can report it at the Public Issues by selecting the right 
component here 
<https://cloud.google.com/support/docs/issue-trackers#trackers-list>. 

Please also note that Google Groups forum is meant for general discussion 
of the platform, not specific technical issues. You can find more info 
about Community Support Overview on Google Groups here 
<https://cloud.google.com/support/docs/community#discussions_google_groups>.


On Wednesday, March 11, 2020 at 11:24:16 AM UTC-4, Emanuel Allen wrote:
>
>
> environment setup logic: two projects one name projectA and another name 
> projectB. projectA contain the mysql database and projectB contain the app 
> engine node server.  
>
> what i have tried is setting the right permission within projectB in I Am 
> with projectA being the sql client 
> projectA @ appspot.gserviceaccount.com     App Engine default service 
> accountCloud SQL Client
>
> i also add this to my *app.yaml* file:
>
>   *DB_CONNECTION*: mysql
>   *DB_HOST*: localhost
>   *DB_DATABASE*: xxxxxxxxxx
>   *DB_USERNAME*: xxxxxxx
>   *DB_PASSWORD*: xxxxxxxx
>   *DB_SOCKET*: /cloudsql/<project-id>:<region-here>:<db-instance-name>
>
> *beta_settings:*
>   # for Cloud SQL, set this value to the Cloud SQL connection name,
>   *cloud_sql_instances*: <project-id>:<region-here>:<db-instance-name>
>
> here how i tried connecting in my database javascript file:
>
>   con = mysql.createConnection({
>     socketPath: "",
>     host: "",
>     user: "",
>     password: ""
>   });
>
> with trying to switch between socketPath and host. the socketpath being: 
>
> socketPath: `/cloudsql/${process.env.CLOUD_SQL_CONNECTION_NAME}`
>
> format.
>
> I tried and struggle with this but refuse to fail, can anyone give me a 
> solution to this?
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/33a6f2a0-b7df-4149-9835-b343b0fb30eb%40googlegroups.com.
  • [google-appe... Emanuel Allen
    • [google... 'Mohammad I (Cloud Platform Support)' via Google App Engine
    • [google... Emanuel Allen
      • [go... 'Manpreet Sidhu (Google Cloud Support)' via Google App Engine
    • [google... 'yananc' via Google App Engine

Reply via email to