ENOENT when connecting to Google Cloud SQL from App Engine

后端 未结 3 961
既然无缘
既然无缘 2021-02-20 08:25

I\'m trying to deploy my Node.js app on Google App Engine and it deployed fine, but it can\'t connect to Google Cloud SQL for some reason. Here\'s what it throws:



        
相关标签:
3条回答
  • 2021-02-20 08:51

    make sure you have added following setting in app.yaml

    beta_settings:
      # The connection name of your instance, available by using
      # 'gcloud beta sql instances describe [INSTANCE_NAME]' or from
      # the Instance details page in the Google Cloud Platform Console.
      cloud_sql_instances: YOUR_INSTANCE_CONNECTION_NAME
    

    ref:https://cloud.google.com/appengine/docs/flexible/nodejs/using-cloud-sql-postgres

    0 讨论(0)
  • 2021-02-20 09:14

    Apparently the order you do things matters...

    1. enable Cloud SQL API
    2. then (re)deploy your app (gcloud app deploy)

    When I did deploy -> create databases -> enable sql ipi I got the ENOENT error

    0 讨论(0)
  • 2021-02-20 09:15

    Check your logs for any errors during startup using:

    1. the following cmd gcloud app logs tail -s default or,

    2. with the log viewer https://console.cloud.google.com/logs/viewer

    Chances are that you have not enabled the Cloud SQL API for your project: https://console.developers.google.com/apis/api/sqladmin/overview

    0 讨论(0)
提交回复
热议问题