firebase-tools icon indicating copy to clipboard operation
firebase-tools copied to clipboard

firebase-tools fails to deploy Functions with an error "HTTP Error: 403, Permission denied to enable service [artifactregistry.googleapis.com]”

Open kyoh86 opened this issue 2 years ago • 0 comments

[REQUIRED] Environment info

firebase-tools: 11.4.2, 11.6.0

Platform: Arch Linux

[REQUIRED] Test case

I don't know that and I have no time to provide it. sorry.

[REQUIRED] Steps to reproduce

firebase deploy --project xxx

[REQUIRED] Expected behavior

deployed.

[REQUIRED] Actual behavior

$ firebase --project xxx deploy --force --debug
[2022-08-14T08:26:45.414Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[2022-08-14T08:26:45.415Z] > authorizing via signed-in user ([email protected])
[2022-08-14T08:26:45.415Z] [iam] checking project xxx for permissions ["cloudfunctions.functions.create","cloudfunctions.functions.delete","cloudfunctions.functions.get","cloudfunctions.functions.list","cloudfunctions.functions.update","cloudfunctions.operations.get","datastore.indexes.create","datastore.indexes.delete","datastore.indexes.list","datastore.indexes.update","firebase.projects.get","firebasehosting.sites.update","firebaserules.releases.create","firebaserules.releases.update","firebaserules.rulesets.create"]
[2022-08-14T08:26:45.416Z] >>> [apiv2][query] POST https://cloudresourcemanager.googleapis.com/v1/projects/xxx:testIamPermissions [none]
[2022-08-14T08:26:45.416Z] >>> [apiv2][(partial)header] POST https://cloudresourcemanager.googleapis.com/v1/projects/xxx:testIamPermissions x-goog-quota-user=projects/xxx
[2022-08-14T08:26:45.416Z] >>> [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/xxx:testIamPermissions {"permissions":["cloudfunctions.functions.create","cloudfunctions.functions.delete","cloudfunctions.functions.get","cloudfunctions.functions.list","cloudfunctions.functions.update","cloudfunctions.operations.get","datastore.indexes.create","datastore.indexes.delete","datastore.indexes.list","datastore.indexes.update","firebase.projects.get","firebasehosting.sites.update","firebaserules.releases.create","firebaserules.releases.update","firebaserules.rulesets.create"]}
[2022-08-14T08:26:46.284Z] <<< [apiv2][status] POST https://cloudresourcemanager.googleapis.com/v1/projects/xxx:testIamPermissions 200
[2022-08-14T08:26:46.285Z] <<< [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/xxx:testIamPermissions {"permissions":["cloudfunctions.functions.create","cloudfunctions.functions.delete","cloudfunctions.functions.get","cloudfunctions.functions.list","cloudfunctions.functions.update","cloudfunctions.operations.get","datastore.indexes.create","datastore.indexes.delete","datastore.indexes.list","datastore.indexes.update","firebase.projects.get","firebasehosting.sites.update","firebaserules.releases.create","firebaserules.releases.update","firebaserules.rulesets.create"]}
[2022-08-14T08:26:46.286Z] >>> [apiv2][query] POST https://iam.googleapis.com/v1/projects/xxx/serviceAccounts/[email protected]:testIamPermissions [none]
[2022-08-14T08:26:46.286Z] >>> [apiv2][body] POST https://iam.googleapis.com/v1/projects/xxx/serviceAccounts/[email protected]:testIamPermissions {"permissions":["iam.serviceAccounts.actAs"]}
[2022-08-14T08:26:47.058Z] <<< [apiv2][status] POST https://iam.googleapis.com/v1/projects/xxx/serviceAccounts/[email protected]:testIamPermissions 200
[2022-08-14T08:26:47.058Z] <<< [apiv2][body] POST https://iam.googleapis.com/v1/projects/xxx/serviceAccounts/[email protected]:testIamPermissions {"permissions":["iam.serviceAccounts.actAs"]}
[2022-08-14T08:26:47.059Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/xxx [none]
[2022-08-14T08:26:47.632Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/xxx 200
[2022-08-14T08:26:47.632Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/xxx {"projectId":"xxx","projectNumber":"941330650514","displayName":"Upmind - staging","name":"projects/xxx","resources":{"hostingSite":"xxx","storageBucket":"xxx.appspot.com","locationId":"asia-northeast1"},"state":"ACTIVE","etag":"1_0d70d1e5-3322-458e-8cfc-6c2b3fc43643"}

=== Deploying to 'xxx'...

i  deploying storage, firestore, functions, hosting 
Running command: yarn --cwd "$RESOURCE_DIR" run lint
yarn run v1.22.19
$ eslint --ext .js,.ts .
Done in 2.88s.
Running command: yarn --cwd "$RESOURCE_DIR" run build
yarn run v1.22.19
$ npm run clean
npm WARN lifecycle The node binary used for scripts is /tmp/yarn--1660465610751-0.21329667840709354/node but npm is using /home/yyy/.local/share/asdf/installs/nodejs/14.19.0/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.

> functions@ clean /home/yyy/Projects/github.com/yyy/yyy/functions
> rimraf lib

$ tsc
Done in 8.01s.
✔  functions: Finished running predeploy script. 
[2022-08-14T08:26:58.745Z] >>> [apiv2][query] GET https://appengine.googleapis.com/v1/apps/xxx [none]
[2022-08-14T08:26:59.120Z] <<< [apiv2][status] GET https://appengine.googleapis.com/v1/apps/xxx 200
[2022-08-14T08:26:59.121Z] <<< [apiv2][body] GET https://appengine.googleapis.com/v1/apps/xxx {"name":"apps/xxx","id":"xxx","authDomain":"gmail.com","locationId":"asia-northeast1","codeBucket":"staging.xxx.appspot.com","servingStatus":"SERVING","defaultHostname":"xxx.an.r.appspot.com","defaultBucket":"xxx.appspot.com","serviceAccount":"[email protected]","gcrDomain":"asia.gcr.io","databaseType":"CLOUD_FIRESTORE","featureSettings":{"splitHealthChecks":true,"useContainerOptimizedOs":true}}
i  firebase.storage: checking storage.rules for compilation errors... 
[2022-08-14T08:26:59.122Z] >>> [apiv2][query] POST https://firebaserules.googleapis.com/v1/projects/xxx:test [none]
[2022-08-14T08:26:59.122Z] >>> [apiv2][body] POST https://firebaserules.googleapis.com/v1/projects/xxx:test [omitted]
[2022-08-14T08:27:00.509Z] <<< [apiv2][status] POST https://firebaserules.googleapis.com/v1/projects/xxx:test 200
[2022-08-14T08:27:00.509Z] <<< [apiv2][body] POST https://firebaserules.googleapis.com/v1/projects/xxx:test {}
✔  firebase.storage: rules file storage.rules compiled successfully 
i  firestore: reading indexes from firestore.indexes.json... 
i  cloud.firestore: checking firestore.rules for compilation errors... 
[2022-08-14T08:27:00.512Z] >>> [apiv2][query] POST https://firebaserules.googleapis.com/v1/projects/xxx:test [none]
[2022-08-14T08:27:00.512Z] >>> [apiv2][body] POST https://firebaserules.googleapis.com/v1/projects/xxx:test [omitted]
[2022-08-14T08:27:01.567Z] <<< [apiv2][status] POST https://firebaserules.googleapis.com/v1/projects/xxx:test 200
[2022-08-14T08:27:01.567Z] <<< [apiv2][body] POST https://firebaserules.googleapis.com/v1/projects/xxx:test {}
✔  cloud.firestore: rules file firestore.rules compiled successfully 
[2022-08-14T08:27:01.568Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/xxx [none]
[2022-08-14T08:27:02.034Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/xxx 200
[2022-08-14T08:27:02.034Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/xxx {"projectId":"xxx","projectNumber":"941330650514","displayName":"Upmind - staging","name":"projects/xxx","resources":{"hostingSite":"xxx","storageBucket":"xxx.appspot.com","locationId":"asia-northeast1"},"state":"ACTIVE","etag":"1_0d70d1e5-3322-458e-8cfc-6c2b3fc43643"}
i  functions: ensuring required API cloudfunctions.googleapis.com is enabled... 
i  functions: ensuring required API cloudbuild.googleapis.com is enabled... 
i  artifactregistry: ensuring required API artifactregistry.googleapis.com is enabled... 
[2022-08-14T08:27:02.035Z] >>> [apiv2][query] GET https://serviceusage.googleapis.com/v1/projects/xxx/services/cloudfunctions.googleapis.com [none]
[2022-08-14T08:27:02.036Z] >>> [apiv2][query] GET https://serviceusage.googleapis.com/v1/projects/xxx/services/runtimeconfig.googleapis.com [none]
[2022-08-14T08:27:02.037Z] >>> [apiv2][query] GET https://serviceusage.googleapis.com/v1/projects/xxx/services/cloudbuild.googleapis.com [none]
[2022-08-14T08:27:02.038Z] >>> [apiv2][query] GET https://serviceusage.googleapis.com/v1/projects/xxx/services/artifactregistry.googleapis.com [none]
[2022-08-14T08:27:03.301Z] <<< [apiv2][status] GET https://serviceusage.googleapis.com/v1/projects/xxx/services/cloudbuild.googleapis.com 200
[2022-08-14T08:27:03.301Z] <<< [apiv2][body] GET https://serviceusage.googleapis.com/v1/projects/xxx/services/cloudbuild.googleapis.com [omitted]
✔  functions: required API cloudbuild.googleapis.com is enabled 
[2022-08-14T08:27:03.334Z] <<< [apiv2][status] GET https://serviceusage.googleapis.com/v1/projects/xxx/services/artifactregistry.googleapis.com 200
[2022-08-14T08:27:03.334Z] <<< [apiv2][body] GET https://serviceusage.googleapis.com/v1/projects/xxx/services/artifactregistry.googleapis.com [omitted]
⚠  artifactregistry: missing required API artifactregistry.googleapis.com. Enabling now... 
[2022-08-14T08:27:03.335Z] >>> [apiv2][query] POST https://serviceusage.googleapis.com/v1/projects/xxx/services/artifactregistry.googleapis.com:enable [none]
[2022-08-14T08:27:03.372Z] <<< [apiv2][status] GET https://serviceusage.googleapis.com/v1/projects/xxx/services/runtimeconfig.googleapis.com 200
[2022-08-14T08:27:03.373Z] <<< [apiv2][body] GET https://serviceusage.googleapis.com/v1/projects/xxx/services/runtimeconfig.googleapis.com [omitted]
[2022-08-14T08:27:03.461Z] <<< [apiv2][status] GET https://serviceusage.googleapis.com/v1/projects/xxx/services/cloudfunctions.googleapis.com 200
[2022-08-14T08:27:03.461Z] <<< [apiv2][body] GET https://serviceusage.googleapis.com/v1/projects/xxx/services/cloudfunctions.googleapis.com [omitted]
✔  functions: required API cloudfunctions.googleapis.com is enabled 
[2022-08-14T08:27:05.180Z] <<< [apiv2][status] POST https://serviceusage.googleapis.com/v1/projects/xxx/services/artifactregistry.googleapis.com:enable 403
[2022-08-14T08:27:05.181Z] <<< [apiv2][body] POST https://serviceusage.googleapis.com/v1/projects/xxx/services/artifactregistry.googleapis.com:enable [omitted]

Error: HTTP Error: 403, Permission denied to enable service [artifactregistry.googleapis.com]
Help Token: AfeSHlI1DXPbVFDjSlrgAm1bDOZ5jK3ve06GkacEy7luE5AUDSLJ0wMkHdCuh7ZYvHnLOtb9qQ2MDo9axYgP7NJz1TYR7qvb7Qe0Y4q5wbjJZYPI
[2022-08-14T08:27:05.743Z] Error Context: {
  "body": {
    "error": {
      "code": 403,
      "message": "Permission denied to enable service [artifactregistry.googleapis.com]\nHelp Token: AfeSHlI1DXPbVFDjSlrgAm1bDOZ5jK3ve06GkacEy7luE5AUDSLJ0wMkHdCuh7ZYvHnLOtb9qQ2MDo9axYgP7NJz1TYR7qvb7Qe0Y4q5wbjJZYPI",
      "status": "PERMISSION_DENIED",
      "details": [
        {
          "@type": "type.googleapis.com/google.rpc.PreconditionFailure",
          "violations": [
            {
              "type": "googleapis.com",
              "subject": "?error_code=110002&service=serviceusage.googleapis.com&permission=serviceusage.services.enable&resource=xxx"
            }
          ]
        },
        {
          "@type": "type.googleapis.com/google.rpc.ErrorInfo",
          "reason": "AUTH_PERMISSION_DENIED",
          "domain": "serviceusage.googleapis.com",
          "metadata": {
            "service": "serviceusage.googleapis.com",
            "permission": "serviceusage.services.enable",
            "resource": "xxx"
          }
        }
      ]
    }
  },
  "response": {
    "statusCode": 403
  }
}

Additional information

Using 11.1.0, it was successful.

kyoh86 avatar Aug 14 '22 08:08 kyoh86