云 SQL 管理员 Api GCF 警告

Cloud SQL Admin Api Warning in GCF

我在 GCF 中部署了一个函数,该函数在节点 js 中执行。它适用于 MySQL 的 Cloud SQL 实例。 我不时收到此警告。

CloudSQL warning: your action is needed to update your function and avoid potential disruptions. Please see https://cloud.google.com/functions/docs/sql#troubleshooting for additional details: ensure that the account has access to "-mysql-dev7" (and make sure there's no typo in that name). Error during createEphemeral for -mysql-dev7: googleapi: Error 403: Cloud SQL Admin API has not been used in project 319049 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/sqladmin.googleapis.com/overview?project=319049* then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry., accessNotConfigured

并且在此警告函数之后继续执行。这是什么意思?为什么功能没有停止。如果它不重要,那是什么意思,如果我不启用此管理员会怎样 API? 顺便说一句,函数只做选择和更新,它不会改变 table 结构所以理论上为什么它需要 Admin API?

我理解警告消息可能带来的混乱,尤其是当它们对您的函数的工作流程没有明显影响时。

据我所知,警告表明如果不启用此 API,则在需要执行某些需要 Cloud SQL Admin API. Potential uses for the Cloud SQL Admin API can be found under public documentation 的任务时可能会出现更多问题。如果您需要列出项目中的 Cloud SQL 实例、获取特定实例的数据库、创建新的 Cloud SQL 实例或执行列出的任何其他操作,请启用 API.

为了避免同时看到这些警告,我建议启用 API。

编辑:

Cloud Functions 利用一种机制 connect to Cloud SQL instances via the Cloud SQL proxy, the Cloud SQL proxy in turn utilizes the Cloud SQL Admin API

因此,在未启用 Cloud SQL Admin API 的情况下连接到 Cloud SQL 实例时,将抛出错误消息。

Cloud Functions 仍然能够连接到云 SQL 实例,因为它在无法通过云 SQL 代理连接时使用旧连接机制。

这就是为什么函数不会停止并且仍然可以按预期对实例执行操作的原因。

启用Cloud SQL Admin API将解决警告: