Search code examples
google-cloud-sqlgoogle-app-maker

Issues SQL connection with a specific account


I'm having an issue with the CloudSQL connection on a specific account. If I use account A to preview the project it works fine, yet account B with the exact same cloudSQL credentials is unable to preview, account B is the owner of the project.

enter image description here

They both have the same IAM roles in the cloudSQL project and both accounts were able to preview last week. I've tried deleting cache, navigation files and another browser using account B.

Any ideas?


Solution

  • I'm going to add a new answer to resolve this because I think it's worthwhile to keep the previous answer and discussion intact. The issue here was that the accounts which did not work have the "Viewer" role in the IAM & Admin section of the Google Cloud SQL project. The Viewer role gives (among other permissions) read access to Cloud SQL, but not write access.

    The best role to use if restricted access is required, but they need full access to read/write SQL, is the Google Cloud SQL Client role. See https://cloud.google.com/sql/docs/mysql/project-access-control for more information on roles and what access they give.

    Thanks for Juan for help tracking all this down.

    Edit: It's also worth mentioning that the reason this works in the Editor, but not in Preview/Deployments is the editor is explicitly whitelisted for access (as one of the steps we ask you to do in the documentation), so it doesn't use role permissions for a particular account, while access through your deployments is not explicitly whitelisted in this way, so role permissions are enforced.