Unable to connect to Cloud SQL from Node JS

ยอดดู 1,368 ครั้ง
ข้ามไปที่ข้อความที่ยังไม่อ่านรายการแรก

Lalit Indoria

ยังไม่อ่าน,
27 พ.ค. 2561 11:48:2227/5/61
ถึง Google Cloud SQL discuss
Hi

I am trying to connect to node JS from my sails js app that's hosted on App Engine in the same project as Cloud SQL. I have tried multiple combinations but failed every time.

Here' what the log says:

name=AdapterError, adapterMethodName=create, modelIdentity=admin, name=Exception, code=badConnection, exit=badConnection, errorno=ETIMEDOUT, code=ETIMEDOUT, syscall=connect, fatal=true, host=35.230.110.241, port=3306, schema=true, adapter=sails-mysql, socketPath=/cloudsql/parsley-dev:us-west1:parsley-dev, user=parsley-dev, password=parsleyDevApi, database=parsley, identity=default, url=mysql://parsley-dev:parsle...@35.230.110.241:3306/parsley, isOperational=true, adapterMethodName=create, modelIdentity=admin, $ref=$["cause"]["raw"]

My sails JS adapter configuration:

adapter: 'sails-mysql',
socketPath: `/cloudsql/${process.env.INSTANCE_CONNECTION_NAME}`,
user: process.env.SQL_USER,
password: process.env.SQL_PASSWORD,
host: '35.230.110.241',
database: 'parsley'

Would be great if someone can help me.

Kenworth (Google Cloud Platform)

ยังไม่อ่าน,
28 พ.ค. 2561 15:03:3228/5/61
ถึง Google Cloud SQL discuss
Hi Lalit, I found this similar connection issue on StackOverflow on which a user resolved it by not using the hostname. Unfortunately, we do not have enough visibility on the third-party 'sails' adapter (see knex alternative third-party adapter) to troubleshoot. 

A thread like this is beyond the scope of Google Groups which is reserved for general discussion of GCP's products and services. I recommend you go through our Quickstart Tutorials or for further technical assistance, try Stack Exchange sites. Stack Exchange uses a popular question-and-answer platform and it hosts a number of sites, including StackOverflow. Please visit our community support page for list of StackOverflow tags we monitor.

Fabrizio Riccardo

ยังไม่อ่าน,
20 ก.ค. 2561 11:10:5220/7/61
ถึง Google Cloud SQL discuss
I have the same problem.
Did you find any solution?

Fabrizio Riccardo

ยังไม่อ่าน,
20 ก.ค. 2561 11:10:5220/7/61
ถึง Google Cloud SQL discuss
Did you find a solution?


Il giorno domenica 27 maggio 2018 17:48:22 UTC+2, Lalit Indoria ha scritto:

Kurtis Van Gent

ยังไม่อ่าน,
23 ก.ค. 2561 11:25:5923/7/61
ถึง Google Cloud SQL discuss
Hi Fabrizio,

What Kenworth posted above is correct, you should only use either host/post to connect via TCP or you should use socketPath to connect with a UnixSocket. For AppEngine Standard you have to use a unix socket, for AppEngine Flex you can choose whichever is better for your situation. 
ตอบทุกคน
ตอบกลับผู้สร้าง
ส่งต่อ
ข้อความใหม่ 0 รายการ