'Cloud SQL Admin Api Warning in GCF

I have a function deployed in GCF which is executed in node js. And it works with Cloud SQL instance of MySQL. And I receive this warning from time to time.

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

And after this warning function continues to execute. What does it mean? Why function is not halted. If it is not important what does it mean and what if I don't enable this admin API? BTW function only does selects and updates, it doesn't change table structure so theoretically why would it need Admin API?



Solution 1:[1]

I understand the confusion that warning messages may bring, especially if they have no noticeable effects on your function’s workflow.

To the best of my knowledge, the warning identifies that through not enabling this API, there will be potential for further issues when in need of performing certain tasks which require the Cloud SQL Admin API. Potential uses for the Cloud SQL Admin API can be found under public documentation. If you would ever need to list the Cloud SQL instances in a project, get the database of a particular instance, create a new Cloud SQL instance, or perform any other operation listed, please enable the API.

To avoid seeing these warnings all together, I would recommend enabling the API.

EDIT:

Cloud Functions utilizes a mechanism to connect to Cloud SQL instances via the Cloud SQL proxy, the Cloud SQL proxy in turn utilizes the Cloud SQL Admin API.

Therefore when connecting to a Cloud SQL instance without the Cloud SQL Admin API enabled, the error message is thrown.

Cloud Functions is still able to connect to the Cloud SQL instance as it utilizes a legacy connection mechanism when it is unable to do so via the Cloud SQL proxy.

This is why the function does not halt and can still perform the operations on the instance as expected.

Solution 2:[2]

Enabling Cloud SQL Admin API will solve the warning:

enter image description here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Kai - Kazuya Ito