Home > Software design >  Unable to Deploy Cloud Functions - Permission denied to enable service [artifactregistry.googleapis.
Unable to Deploy Cloud Functions - Permission denied to enable service [artifactregistry.googleapis.

Time:09-05

I'm trying to deploy the default test function to check that everything works.

const functions = require("firebase-functions");

exports.helloWorld = functions.https.onRequest((request, response) => {
  functions.logger.info("Hello logs!", {structuredData: true});
  response.send("Hello from Firebase!");
});

But when I run firebase deploy or firebase deploy --only functions, I get the following error:

i  artifactregistry: ensuring required API artifactregistry.googleapis.com is enabled...
!  artifactregistry: missing required API artifactregistry.googleapis.com. Enabling now...
Error: HTTP Error: 403, Permission denied to enable service [artifactregistry.googleapis.com]

The owner has granted me Cloud Functions Admin, Firebase Admin and Service Account User roles, which is sufficient according to the Firebase Support representative.

I have tried logging in/out, reinstalling Firebase command line tools via npm install -g firebase-tools, rerunning firebase init. But I still receive the same error.

Does anyone have any experience with this particular error?

CodePudding user response:

I found a solution and I'm now able to deploy. Here's the answer that worked for me.

As I mentioned in my question, enabling Cloud Functions Admin, Firebase Admin and Service Account User roles did not fix the problem. So I asked the owner to give me the API Keys Admin role.

Also, I noticed the Artefact Registry API was not enabled at https://console.cloud.google.com/marketplace/product/google/artifactregistry.googleapis.com

Since the error was Permission denied to enable service [artifactregistry.googleapis.com], I asked the owner to enable it manually.

Doing these two things solved the problem, and I am now able to deploy cloud functions.

  • Related