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

Mobile SDK API has not been used in project

Open yellowhat opened this issue 2 years ago • 7 comments

[REQUIRED] Environment info

firebase-tools: 12.5.1

Platform: Ubuntu

[REQUIRED] Test case

Hi, after adding the googlecloud/[email protected] to our extensions:

  "extensions": {
    "firestore-send-email": "firebase/[email protected]",
    "mailchimp-firebase-sync": "mailchimp/[email protected]",
    "firestore-semantic-search": "googlecloud/[email protected]"
  }

we are not able to deploy extensions anymore via GitHub actions using a GCP Service Account key to authenticate:

      - name: Decode Google Cloud Service Account key
        env:
          GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }}
        run: |
          echo "$GCP_SA_KEY" | base64 -d > /tmp/creds.json
          echo "GOOGLE_APPLICATION_CREDENTIALS=/tmp/creds.json" >>"$GITHUB_ENV"

      - name: Deploy Firebase - functions
        run: |
          echo \"N\n\" | firebase deploy --only functions --interactive

      - name: Deploy Firebase except hosting
        run: |
          firebase deploy \
              --except functions,hosting \
              --project "$GOOGLE_CLOUD_PROJECT" \
              --debug

we get the following error:

Error when checking App Developer TOS for xxx. This is expected if authenticated via a service account: FirebaseError: HTTP Error: 403, Firebase Extensions Terms of Service Private API has not been used in project xxx before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/firebaseextensionstos-pa.googleapis.com/overview?project=xxx then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.

...

Error: HTTP Error: 403, Mobile SDK API has not been used in project xxx before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/mobilesdk-pa.googleapis.com/overview?project=xxx then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
[2023-08-24T07:51:19.965Z] Error Context: {
  "body": {
    "error": {
      "code": 403,
      "message": "Mobile SDK API has not been used in project xxx before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/mobilesdk-pa.googleapis.com/overview?project=xxx then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.",
      "status": "PERMISSION_DENIED",
      "details": [
        {
          "@type": "type.googleapis.com/google.rpc.Help",
          "links": [
            {
              "description": "Google developers console API activation",
              "url": "https://console.developers.google.com/apis/api/mobilesdk-pa.googleapis.com/overview?project=xxx"
            }
          ]
        },
        {
          "@type": "type.googleapis.com/google.rpc.ErrorInfo",
          "reason": "SERVICE_DISABLED",
          "domain": "googleapis.com",
          "metadata": {
            "consumer": "projects/xxx",
            "service": "mobilesdk-pa.googleapis.com"
          }
        }
      ]
    }
  },
  "response": {
    "statusCode": 403
  }
}

The project number matches the real project.

Additional info:

  • the service account associate to that key has owner role on the GCP project
  • Firebase Auth has been enabled via the Firebase UI
  • If I run the steps of the workflow locally logged as the same service account I get the same error.
  • If I run the steps of the workflow up to the GOOGLE_APPLICATION_CREDENTIALS and run firebase login, now on:
$ firebase deploy --only extensions --debug
...
? Do you accept the Firebase Extensions User Terms of Service? (Y/n) 

Running CI after the extension has been deployed leads to the same error

Any suggestions?

Thanks

[REQUIRED] Steps to reproduce

export GOOGLE_APPLICATION_CREDENTIALS=<path_to_json>
firebase deploy --only extensions

[REQUIRED] Expected behavior

Extensions deployed

[REQUIRED] Actual behavior

Error above

yellowhat avatar Aug 30 '23 06:08 yellowhat

I have done other tests using export GOOGLE_APPLICATION_CREDENTIALS=<path_to_json>.

firestore-semantic-search

From fresh firebase project, first:

$ cat firebase.json
{
  "extensions": {
    "firestore-semantic-search": "googlecloud/[email protected]"
  }
}

$ firebase deploy --only extensions --project "$GOOGLE_CLOUD_PROJECT"
...
✔  Deploy complete!

then:

$ cat firebase.json
{
  "extensions": {
    "firestore-send-email": "firebase/[email protected]",
    "mailchimp-firebase-sync": "mailchimp/[email protected]",
    "firestore-semantic-search": "googlecloud/[email protected]"
  }
}

$ firebase deploy --only extensions --project "$GOOGLE_CLOUD_PROJECT"
i  extensions: By installing an extension instance onto a Firebase project, you accept the Firebase Extensions User Terms of Service: https://firebase.google.com/terms/extensions/user

Error: HTTP Error: 403, Mobile SDK API has not been used in project 339893162765 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/mobilesdk-pa.googleapis.com/overview?project=339893162765 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
i  extensions: Verifying secret params for firestore-send-email
(node:573) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 1)
(Use `node --trace-warnings ...` to show where the warning was created)

mailchimp-firebase-sync

From fresh firebase project, first:

$ cat firebase.json
{
  "extensions": {
    "mailchimp-firebase-sync": "mailchimp/[email protected]"
  }
}

$ firebase deploy --only extensions --project "$GOOGLE_CLOUD_PROJECT"
...
✔  Deploy complete!

then:

$ cat firebase.json
{
  "extensions": {
    "firestore-send-email": "firebase/[email protected]",
    "mailchimp-firebase-sync": "mailchimp/[email protected]",
    "firestore-semantic-search": "googlecloud/[email protected]"
  }
}

$ firebase deploy --only extensions --project "$GOOGLE_CLOUD_PROJECT"
i  extensions: By installing an extension instance onto a Firebase project, you accept the Firebase Extensions User Terms of Service: https://firebase.google.com/terms/extensions/user

Error: HTTP Error: 403, Mobile SDK API has not been used in project 339893162765 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/mobilesdk-pa.googleapis.com/overview?project=339893162765 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
i  extensions: Verifying secret params for firestore-send-email
(node:573) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 1)
(Use `node --trace-warnings ...` to show where the warning was created)

firestore-send-email firestore-semantic-search

From fresh firebase project, first:

$ cat firebase.json
{
  "extensions": {
    "firestore-send-email": "firebase/[email protected]",
    "firestore-semantic-search": "googlecloud/[email protected]"
  }
}

$ firebase deploy --only extensions --project "$GOOGLE_CLOUD_PROJECT"
...
✔  Deploy complete!

then:

$ cat firebase.json
{
  "extensions": {
    "firestore-send-email": "firebase/[email protected]",
    "mailchimp-firebase-sync": "mailchimp/[email protected]",
    "firestore-semantic-search": "googlecloud/[email protected]"
  }
}

$ firebase deploy --only extensions --project "$GOOGLE_CLOUD_PROJECT"
i  extensions: By installing an extension instance onto a Firebase project, you accept the Firebase Extensions User Terms of Service: https://firebase.google.com/terms/extensions/user

Error: HTTP Error: 403, Mobile SDK API has not been used in project 339893162765 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/mobilesdk-pa.googleapis.com/overview?project=339893162765 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
i  extensions: Verifying secret params for firestore-send-email
(node:573) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 1)
(Use `node --trace-warnings ...` to show where the warning was created)

firestore-send-email mailchimp-firebase-sync

From fresh firebase project, first:

$ cat firebase.json
{
  "extensions": {
    "firestore-send-email": "firebase/[email protected]",
    "mailchimp-firebase-sync": "mailchimp/[email protected]"
  }
}

$ firebase deploy --only extensions --project "$GOOGLE_CLOUD_PROJECT"
...
✔  Deploy complete!

then:

$ cat firebase.json
{
  "extensions": {
    "firestore-send-email": "firebase/[email protected]",
    "mailchimp-firebase-sync": "mailchimp/[email protected]",
    "firestore-semantic-search": "googlecloud/[email protected]"
  }
}

$ firebase deploy --only extensions --project "$GOOGLE_CLOUD_PROJECT"
i  extensions: By installing an extension instance onto a Firebase project, you accept the Firebase Extensions User Terms of Service: https://firebase.google.com/terms/extensions/user

Error: HTTP Error: 403, Mobile SDK API has not been used in project 339893162765 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/mobilesdk-pa.googleapis.com/overview?project=339893162765 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
i  extensions: Verifying secret params for firestore-send-email
(node:573) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 1)
(Use `node --trace-warnings ...` to show where the warning was created)

firestore-semantic-search mailchimp-firebase-sync

From fresh firebase project, first:

$ cat firebase.json
{
  "extensions": {
    "firestore-semantic-search": "googlecloud/[email protected]",
    "mailchimp-firebase-sync": "mailchimp/[email protected]"
  }
}

$ firebase deploy --only extensions --project "$GOOGLE_CLOUD_PROJECT"
i  extensions: By installing an extension instance onto a Firebase project, you accept the Firebase Extensions User Terms of Service: https://firebase.google.com/terms/extensions/user

Error: HTTP Error: 403, Mobile SDK API has not been used in project 339893162765 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/mobilesdk-pa.googleapis.com/overview?project=339893162765 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
i  extensions: Verifying secret params for firestore-send-email
(node:573) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 1)
(Use `node --trace-warnings ...` to show where the warning was created)

one by one

Even if I install:

  1. mailchimp-firebase-sync
  2. firestore-send-mail
  3. firestore-semantic-search

still:

$ cat firebase.json
{
  "extensions": {
    "firestore-send-email": "firebase/[email protected]",
    "mailchimp-firebase-sync": "mailchimp/[email protected]",
    "firestore-semantic-search": "googlecloud/[email protected]"
  }
}

$ firebase deploy --only extensions --project "$GOOGLE_CLOUD_PROJECT"
i  extensions: By installing an extension instance onto a Firebase project, you accept the Firebase Extensions User Terms of Service: https://firebase.google.com/terms/extensions/user

Error: HTTP Error: 403, Mobile SDK API has not been used in project 339893162765 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/mobilesdk-pa.googleapis.com/overview?project=339893162765 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
i  extensions: Verifying secret params for firestore-send-email
(node:573) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 1)
(Use `node --trace-warnings ...` to show where the warning was created)

yellowhat avatar Sep 19 '23 11:09 yellowhat

Hey @yellowhat, sorry to hear that you're running into this. Unfortunately, this is a known issue for now and the workaround is not authenticate via service account (consider https://firebase.google.com/docs/cli#cli-ci-systems instead). There are 2 error messages here:

1 - Error when checking App Developer TOS for xxx. This is expected if authenticated via a service account This is actually a warning - as long as you've accepted the TOS separately, this won't be blocking.

2 - Mobile SDK API has not been used in project 339893162765 before or it is disabled.

Both of these are caused because the CLI calls a private API. Normally, this works fine - however, when authenticating via a service account, these calls are directed to the service account's project, which cannot have the private API enabled.

We've got a fix in the works to use a different API for 2 that should alleviate this issue. Once that is ready, I'll come back and verify that this issue is resolved.

joehan avatar Sep 19 '23 19:09 joehan

Thank you very much for your reply. I will wait for your fix.

But why I can install each extension one by one and all together throw that error?

yellowhat avatar Sep 19 '23 19:09 yellowhat

I just ran into the same error. Are there any updates to this issue? @joehan

Peetee06 avatar Aug 13 '24 17:08 Peetee06

I'm currently dealing with this error as well @joehan when trying to deploy firebase postgres using a service account. Is there any workaround?

sismanis avatar Aug 14 '24 14:08 sismanis

@sismanis I got my pipeline to work by using the FIREBASE_TOKEN for authentication instead as described here: https://firebase.google.com/docs/cli#cli-ci-systems

Peetee06 avatar Aug 16 '24 16:08 Peetee06

I have a quite similar issue that most probably leads to the same root cause. I'm trying to automatically manage the lifecycle of Firebase web certificates and I can only send requests to this API if I'm a natural user, e.g. the endpoint https://mobilesdk-pa.clients6.google.com/v1/projects/<project-id>/vapidKeys:createVapidKey?alt=json. As a service account, I get the same error message telling me to enable Mobile SDK API in the host Google Cloud project. However, in my Crossplane environment I would like to avoid using a browser login initially just to get a token and I would like to use a service account for performing such tasks. I can imagine similar scenarios if people try to solve it using other IaC tools like Terraform. Seeing this issue resolved would help a lot. Looking forward to a solution. Thanks!

nico151999 avatar Oct 10 '24 08:10 nico151999

FIREBASE_TOKEN is deprecated. is there any solution for this?

just because i tried to move to GOOGLE_APPLICATION_CREDENTIALS, but im getting the same error.. STILL.

artanisdesign avatar Mar 24 '25 12:03 artanisdesign

And the best part is.. somehow DataConnect wont deploy with token anymore in CI

artanisdesign avatar Mar 24 '25 12:03 artanisdesign

I am having the same issue while trying to deploy Data Connect, that is only possible using a service account atm.

FYI: Also while switching to a service account login (from token), it made me enable the Billing API on my projects (to deploy functions and firestore) which was not necessary previously while using the token.

Hiraqui avatar Apr 15 '25 12:04 Hiraqui

I am having the same issue while trying to deploy Data Connect, that is only possible using a service account atm.

FYI: Also while switching to a service account login (from token), it made me enable the Billing API on my projects (to deploy functions and firestore) which was not necessary previously while using the token.

Same here. I'm also trying to deploy using a service account instead of a CI token.

kotaroyamazaki avatar Apr 17 '25 08:04 kotaroyamazaki

Since it went GA, deploying with a token started failing

kotaroyamazaki avatar Apr 17 '25 09:04 kotaroyamazaki

Same here.

santa112358 avatar Apr 17 '25 09:04 santa112358

Same issue for me

Bindslev avatar Apr 20 '25 14:04 Bindslev

Hey all, thanks for reporting these issues with data connect deploy. I'll pass them along to our backend folks to try to figure out why tokens are not working fore deployment anymore.

If anyone has it available, it would be helpful to see a firebase-debug.log from the failed runs.

joehan avatar Apr 22 '25 17:04 joehan

With token

firebase v14.2.0

firebase dataconnect:sql:migrate --token *** --force --project dev

  shell: /usr/bin/bash -e {0}
⚠  Authenticating with `--token` is deprecated and will be removed in a future major version of `firebase-tools`. Instead, use a service account key with `GOOGLE_APPLICATION_CREDENTIALS`: https://cloud.google.com/docs/authentication/getting-started
⚠  Authenticating with `--token` is deprecated and will be removed in a future major version of `firebase-tools`. Instead, use a service account key with `GOOGLE_APPLICATION_CREDENTIALS`: https://cloud.google.com/docs/authentication/getting-started
i  dataconnect: ensuring required API firebasedataconnect.googleapis.com is enabled...
✔  dataconnect: required API firebasedataconnect.googleapis.com is enabled
i  dataconnect: ensuring required API sqladmin.googleapis.com is enabled...
✔  dataconnect: required API sqladmin.googleapis.com is enabled
i  dataconnect: ensuring required API compute.googleapis.com is enabled...
✔  dataconnect: required API compute.googleapis.com is enabled
⚠  Authenticating with `--token` is deprecated and will be removed in a future major version of `firebase-tools`. Instead, use a service account key with `GOOGLE_APPLICATION_CREDENTIALS`: https://cloud.google.com/docs/authentication/getting-started

Error: No account to set up! Run `firebase login` or set Application Default Credentials
Error: Process completed with exit code 1.

No *-debug.log or .firebase folder is created.

If I switch to v13.32.0, the same job works just fine.

With service account

firebase v14.2.0

The previous job completes successfully:

firebase dataconnect:sql:migrate --force --project dev
  env:
    GOOGLE_APPLICATION_CREDENTIALS: google-application-credentials.json

But the deploy one fails

firebase deploy --only dataconnect --force --project dev
  env:
    GOOGLE_APPLICATION_CREDENTIALS: google-application-credentials.json

=== Deploying to ***...

i  deploying dataconnect
i  dataconnect: ensuring required API firebasedataconnect.googleapis.com is enabled...
✔  dataconnect: required API firebasedataconnect.googleapis.com is enabled
i  dataconnect: ensuring required API sqladmin.googleapis.com is enabled...
✔  dataconnect: required API sqladmin.googleapis.com is enabled
i  dataconnect: ensuring required API compute.googleapis.com is enabled...
✔  dataconnect: required API compute.googleapis.com is enabled

Error: Request to https://mobilesdk-pa.googleapis.com/v1/accessmanagement/tos:getStatus had HTTP Error: 403, Mobile SDK API has not been used in project 17056[8](https://github.com/LARP-inc/circularity-tool/actions/runs/14664390064/job/41155694871#step:7:8)2025 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/mobilesdk-pa.googleapis.com/overview?project=1705682025 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
Error: Process completed with exit code 1.

No *-debug.log or .firebase folder is created.

Hiraqui avatar Apr 25 '25 12:04 Hiraqui

This seems to be fixed in v14.5.0 for dataconnect deploy

Hiraqui avatar May 30 '25 11:05 Hiraqui

Forgot to close this wiht #8500, but this is fixed now!

joehan avatar Jun 03 '25 17:06 joehan