pythonshellgoogle-cloud-platformfaas

Cannot Deploy GCP Python Cloud Function


I've been using GCP for some time.

I created a new GCP Project to test new functions, and enabled the Runtime API.

However, clicking Deploy pops up this message: "User does not have the 'iam.serviceAccounts.actAs' permission on webcalc-taskc2@appspot.gserviceaccount.com required to create the function. You can fix this by running gcloud iam service-accounts add-iam-policy-binding webcalc-taskc2@appspot.gserviceaccount.com --member=user: --role=roles/iam.serviceAccountUser"

I entered this into Shell, replacing with my Owner email for GCP. Still no luck ;(


Solution

  • You have to add permissions that can use service account to your account.

    According to Google document, A service account is a special type of Google account intended to represent a non-human user that needs to authenticate and be authorized to access data in Google APIs.

    Seems that "webcalc-taskc2@appspot.gserviceaccount.com" is your service account runs cloud function.

    The pop up message you received said that a user account running cloud function does not have 'iam.serviceAccounts.actAs' permission on that service account.

    So you have to entered command in the message with replaced --member=user to --member=user:Your account email.

    You can check your cloud function service account at details -> General information tab.

    enter image description here