Re: ENOENT accessing socket

822 views
Skip to first unread message
Message has been deleted

Adam (Cloud Platform Support)

unread,
May 5, 2017, 12:57:43 PM5/5/17
to Google Cloud SQL discuss
This is a known issue with the tutorial. The NODE_ENV environment variable doesn't get set to "production" automatically, so the app still tries to connect to localhost in production and fails. A workaround is to add the following to your config.json:

"NODE_ENV": "production"

Note that to actually see the /cloudsql socket, you need to connect to the running docker container after SSHing into the instance eg.

sudo docker exec -it gaeapp /bin/bash
ls
-l /

On Friday, May 5, 2017 at 9:50:49 AM UTC-4, Rei Y. wrote:
I followed https://cloud.google.com/appengine/docs/flexible/nodejs/using-cloud-sql. The deployed app fails to connect to the socket, which not seem to be present when I
ssh into the instance in /cloudsql (the directory is empty). App and SQL instance are in the same project.

I have the following in app.yaml:

beta_settings:
  cloud_sql_instances: project:location:instance
 
and in mysql options in nodejs

socketPath: "/cloudsql/project:location:instance"

 Nothing appears in the logs, except in my app stderr

{"code":"ENOENT","errno":"ENOENT","syscall":"connect","address":"project:location:instance","fatal":true}

(project:location:instance is not actually "project:location:instance" but the value for connectionName returned by `gcloud sql instances describe`)
Message has been deleted
Message has been deleted
Message has been deleted

Adam (Cloud Platform Support)

unread,
May 12, 2017, 1:25:15 PM5/12/17
to Google Cloud SQL discuss
Are the app and the Cloud SQL instance on the same project? When I deploy the docs sample (with the NODE_ENV fix) the socket is there, and it connects without issue.

If you want to submit sample project code that reproduces the issue, you can open a bug on the Cloud Platform issue tracker under the Cloud SQL component and we can take a look at it.

On Wednesday, May 10, 2017 at 11:25:09 AM UTC-4, Rei Y. wrote:
I am not running the tutorial. I'm moving a production-ready application from another cloud provider. NODE_ENV is already on production. I connected to the docker container in the same way you described when I first tried to debug the issue.

So, step by step I did:

- create a MySQL second generation instance;
- add to app.yaml:

beta_settings:
  cloud_sql_instances: project:location:instance
  corresponding to the reported Instance connection name for the MySQL instance;
- deploy

Am I missing something?
Reply all
Reply to author
Forward
0 new messages