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