Friday, May 5, 2017

[google-cloud-sql-discuss] Re: ENOENT accessing socket

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`)

--
You received this message because you are subscribed to the Google Groups "Google Cloud SQL discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-cloud-sql-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-cloud-sql-discuss/f6ab85bc-0642-4070-8ec1-945dd66c153e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment