firebase / firebase-tools

The Firebase Command Line Tools
MIT License
4.01k stars 930 forks source link

Error: Failed to get Firebase project 123456789 after reinstalling Firebase CLI #7178

Closed watagori closed 4 months ago

watagori commented 4 months ago

[REQUIRED] Environment info

firebase-tools: 13.8.3

Platform: macOS

npm: 10.5.0

node: v20.12.2

[REQUIRED] Test case

Commands to reproduce the issue:

npm uninstall -g firebase-tools
npm cache clean --force
npm install -g firebase-tools
firebase login
firebase login --reauth

[REQUIRED] Steps to reproduce

  1. Uninstall Firebase CLI
  2. Clean npm cache
  3. Reinstall Firebase CLI
  4. Run firebase login

[REQUIRED] Expected behavior

The firebase login command should run successfully, allowing login to the Firebase project.

[REQUIRED] Actual behavior

Running the firebase login command results in the following error message:

Error: Failed to get Firebase project 123456789. Please make sure the project exists and your account has permission to access it.

I am the owner of the Firebase project and I can access everything from the browser without any issues.

[REQUIRED] Debug logs

firebase login --debug
[2024-05-14T09:18:53.854Z] > 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"]
[2024-05-14T09:18:53.854Z] > authorizing via signed-in user (user@example.com)
[2024-05-14T09:18:53.856Z] > refreshing access token with scopes: []
[2024-05-14T09:18:53.856Z] >>> [apiv2][query] POST https://www.googleapis.com/oauth2/v3/token [none]
[2024-05-14T09:18:53.857Z] >>> [apiv2][body] POST https://www.googleapis.com/oauth2/v3/token [omitted]
[2024-05-14T09:18:54.037Z] <<< [apiv2][status] POST https://www.googleapis.com/oauth2/v3/token 400
[2024-05-14T09:18:54.037Z] <<< [apiv2][body] POST https://www.googleapis.com/oauth2/v3/token [omitted]
[2024-05-14T09:18:54.037Z] Authentication Error: Your credentials are no longer valid. Please run firebase login --reauth

For CI servers and headless environments, generate a new token with firebase login:ci
[2024-05-14T09:18:54.162Z] FirebaseError: Authentication Error: Your credentials are no longer valid. Please run firebase login --reauth

For CI servers and headless environments, generate a new token with firebase login:ci
    at invalidCredentialError (/path/to/node_modules/firebase-tools/lib/auth.js:142:12)
    at refreshTokens (/path/to/node_modules/firebase-tools/lib/auth.js:515:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async getAccessToken (/path/to/node_modules/firebase-tools/lib/apiv2.js:40:18)
    at async Client.addAuthHeader (/path/to/node_modules/firebase-tools/lib/apiv2.js:167:21)
    at async Client.request (/path/to/node_modules/firebase-tools/lib/apiv2.js:118:34)
    at async getFirebaseProject (/path/to/node_modules/firebase-tools/lib/management/projects.js:295:21)
    at async Command.resolveProjectIdentifiers (/path/to/node_modules/firebase-tools/lib/command.js:207:50)
    at async Command.prepare (/path/to/node_modules/firebase-tools/lib/command.js:180:13)
    at async /path/to/node_modules/firebase-tools/lib/command.js:224:13

Error: Failed to get Firebase project 123456789012. Please make sure the project exists and your account has permission to access it.
joehan commented 4 months ago

@watagori - could you try running firebase logout then rerunning firebase login?

google-oss-bot commented 4 months ago

Hey @watagori. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 3 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot commented 4 months ago

Since there haven't been any recent updates here, I am going to close this issue.

@watagori if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.