getaddrinfo ENOTFOUND API Google Cloud

后端 未结 2 619
北海茫月
北海茫月 2020-12-19 14:49

I\'m trying to execute API.AI tutorial for building a weather bot for Google Assistant (the one here: https://dialogflow.com/docs/getting-started/basic-fulfillment-conversat

相关标签:
2条回答
  • 2020-12-19 15:05

    Oh boy, in fact the reason was most stupid ever. I didn't enable "billing" on Google Cloud Platform and that's why it blocked everything (even though I'm using a free test of the API). They just wanted my credit card number. It works now

    0 讨论(0)
  • 2020-12-19 15:06

    I had the same issue trying to hit my db. Billing wasn't the fix as I had billing enabled already.

    For me it was knexfile.js setup for MySql - specifically the connection object. In that object, you should replace the host key with socketPath; and prepend /cloudsql/ to the value. Here's an example:

    connection: {
      // host: process.env.APP_DB_HOST, // The problem
      socketPath: `/cloudsql/${process.env.APP_DB_HOST}`, // The fix
      database: process.env.APP_DB_NAME,
      user: process.env.APP_DB_USR,
      password: process.env.APP_DB_PWD
    }
    

    Where process.env.APP_DB_HOST is your Instance connection name.

    PS: I imagine that even if you're not using Knex, the host or server parameter of a typical DB connectionstring will have to be called socketPath when connecting to Google Cloud SQL.

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