Search code examples
firebasegoogle-cloud-functionsfirebase-cli

Firebase - lacks IAM permission "cloudscheduler.jobs.update"


After implementing firebase function as below code, deploy failed.

generateDailyStat: functions.pubsub.schedule('every day 00:00').timeZone('Asia/Seoul').onRun(generateDailyStat),

Error messages are as below.

i  functions: creating Node.js 8 function generateDailyStat(us-central1)...
i  scheduler: ensuring necessary APIs are enabled...
i  pubsub: ensuring necessary APIs are enabled...
✔  scheduler: all necessary APIs are enabled
✔  pubsub: all necessary APIs are enabled

Error: HTTP Error: 403, The principal (user or service account) lacks IAM permission "cloudscheduler.jobs.update" for the resource "projects/MY_PROJECT/locations/asia-northeast2/jobs/firebase-schedule-generateDailyStat-us-central1" (or the resource may not exist).

My account is 'owner' role, and I give owner role of cloudscheduler to firebase service account. But still failed.

What did I miss?


Solution

  • I had the same problem. I gave my user all the permissions that could be related to the cloud schedule, and I didn't understand why I was getting this error. Finally, I realized that the region I was trying to deploy to europe-west4, and it seems that in this region, you cannot create a cloud scheduler; there is no option to create it in this region. But I got an error about the permission. (The cloud function was created without a problem)

    I ran the same code in another region, and it worked perfectly.