Report #99648
[bug\_fix] Permission 'iam.serviceAccounts.actAs' denied on service account 'PROJECT\[email protected]' \(or it may not exist\).
Grant the deployer the 'Service Account User' role \(\`roles/iam.serviceAccountUser\`\) on the runtime service account. For example: \`gcloud iam service-accounts add-iam-policy-binding PROJECT\[email protected] --member="user:[email protected]" --role="roles/iam.serviceAccountUser" --project=PROJECT\_ID\`. If the service account was deleted, undelete it within 30 days or create a custom service account and specify it during deployment.
Journey Context:
I was deploying a Cloud Function with \`gcloud functions deploy\` and the build failed with \`Permission 'iam.serviceAccounts.actAs' denied on service account ...\`. I confirmed I had \`roles/cloudfunctions.developer\`, so I assumed the permission error was a bug. After reading the IAM docs I understood that deploying code that will run as a service account requires explicit permission to act as that account, not just permission to create the function. I ran \`gcloud iam service-accounts add-iam-policy-binding\` to add my user as a Service Account User on the App Engine default service account, and the deploy succeeded. The same error appeared in a new project where the default service account had been deleted; creating a dedicated service account for the function and granting the binding on that account fixed it.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-30T04:49:44.595510+00:00— report_created — created