Search code examples
firebasegoogle-cloud-platformgcloud

Can I enabled the 'Firebase Management API' from the command line?


I am trying to automate my google cloud project creation using gcloud and firebase cli.

When I try to create a firebase app using 'firebase apps:create' command, I get an error telling me I need to go to the google cloud console to enable the Firebase Management API for the the project. Not manually going to the google cloud console is EXACTLY what I am trying to avoid my writing this command line script.

Is there are way I can enable this API for a project from the command line?


Solution

  • You can enable any Google API|service using Google's gcloud CLI.

    NOTE This is distinct to the firebase CLI.

    You should be able to:

    PROJECT=[[YOUR-PROJECT]]
    
    gcloud services enable firebase.googleapis.com \
    --project=${PROJECT}
    

    Or, if you replace {PROJECT} with the value in the URL, you can browse the service management page and enable it if necessary:

    https://console.cloud.google.com/apis/library/firebase.googleapis.com?project=${PROJECT}
    

    There are several ways to determine the service (and URI) names.

    You can:

    1. gcloud services list --available --project=${PROJECT}
    2. You can search using Cloud Console
    3. You can search using APIs Explorer