firebase / firebase-tools

The Firebase Command Line Tools
MIT License
3.97k stars 917 forks source link

Error: Failed to list Firebase projects. #2469

Closed Buddhilive closed 3 years ago

Buddhilive commented 3 years ago

I'm going to use AngularFire in my Angular App and host it on Firebase.

Firebase CLI keep throwing this error every time I try to initialize a Firebase project.

Error: Failed to list Firebase projects. See firebase-debug.log for more info.

And my firebase-debug.log file is as follows;

[debug] [2020-07-18T11:57:55.549Z] ----------------------------------------------------------------------
[debug] [2020-07-18T11:57:55.552Z] Command:       C:\Program Files\nodejs\node.exe C:\Users\buddhi.ranasinghe\AppData\Roaming\npm\node_modules\firebase-tools\lib\bin\firebase.js init
[debug] [2020-07-18T11:57:55.552Z] CLI Version:   7.12.1
[debug] [2020-07-18T11:57:55.552Z] Platform:      win32
[debug] [2020-07-18T11:57:55.553Z] Node Version:  v12.18.1
[debug] [2020-07-18T11:57:55.554Z] Time:          Sat Jul 18 2020 17:27:55 GMT+0530 (India Standard Time)
[debug] [2020-07-18T11:57:55.554Z] ----------------------------------------------------------------------
[debug] [2020-07-18T11:57:55.554Z] 
[debug] [2020-07-18T11:57:55.566Z] > 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"]
[debug] [2020-07-18T11:57:55.566Z] > authorizing via signed-in user
[info] 
     ######## #### ########  ######## ########     ###     ######  ########
     ##        ##  ##     ## ##       ##     ##  ##   ##  ##       ##
     ######    ##  ########  ######   ########  #########  ######  ######
     ##        ##  ##    ##  ##       ##     ## ##     ##       ## ##
     ##       #### ##     ## ######## ########  ##     ##  ######  ########

You're about to initialize a Firebase project in this directory:

  D:\DevDojo\blog
[info] 
=== Project Setup
[info] 
[info] First, let's associate this project directory with a Firebase project.
[info] You can create multiple project aliases by running firebase use --add, 
[info] but for now we'll just set up a default project.
[info] 
[debug] [2020-07-18T11:58:01.249Z] > refreshing access token with scopes: ["email","https://www.googleapis.com/auth/cloud-platform","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","openid"]
[debug] [2020-07-18T11:58:01.249Z] >>> HTTP REQUEST POST https://www.googleapis.com/oauth2/v3/token  
 <request body omitted>
[debug] [2020-07-18T11:58:01.492Z] 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
[debug] [2020-07-18T11:58:01.737Z] 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 Object.<anonymous> (C:\Users\buddhi.ranasinghe\AppData\Roaming\npm\node_modules\firebase-tools\lib\auth.js:23:32)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (C:\Users\buddhi.ranasinghe\AppData\Roaming\npm\node_modules\firebase-tools\lib\commands\login.js:8:12)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at loadCommand (C:\Users\buddhi.ranasinghe\AppData\Roaming\npm\node_modules\firebase-tools\lib\commands\index.js:5:19)
    at module.exports (C:\Users\buddhi.ranasinghe\AppData\Roaming\npm\node_modules\firebase-tools\lib\commands\index.js:73:20)
[error] 
[error] Error: Failed to list Firebase projects. See firebase-debug.log for more info.

P.S. I tried the solution give in this Stackoverflow question But it didn't work at all.

samtstern commented 3 years ago

The error message says: Please run firebase login --reauth. Did you try that? If so, what happened?

Buddhilive commented 3 years ago

The error message says: Please run firebase login --reauth. Did you try that? If so, what happened?

Yes. I did that. Reauth works successfully. But when I tried to initialize the project, at the stage where it fetches my existing projects, I get this error. I have another project which I deployed few months back. I tried to re-deploy it to check whether it works. At that moment also I got similar error.

samtstern commented 3 years ago

@Buddhilive hmmm I'm not sure what's going on but maybe you can try an alternate authentication method: https://github.com/firebase/firebase-tools#authentication

For example maybe try running firebase logout and then gcloud auth application-default login and see if you can use the Firebase CLI then?

Buddhilive commented 3 years ago

@Buddhilive hmmm I'm not sure what's going on but maybe you can try an alternate authentication method: https://github.com/firebase/firebase-tools#authentication

For example maybe try running firebase logout and then gcloud auth application-default login and see if you can use the Firebase CLI then?

Yeah, seems like the issue is with my Kaspersky Endpoint Security software. It's blocking some servers like NPM registry too. So I suspect it is doing the same for google auth servers. Can't say exactly. I have no control over it since it's installed and managed by our organization. I report this to System Admins. For the time being, I implemented GitHub actions to deploy my project to Firebase.

michaelalhilly commented 3 years ago

I'm having the same issue. I'm running this from my own mac so I don't believe the issue is related to other software. Also authentication work fine with Firestore commands. So something else is causing this.

Any ideas?

rajkumarboddu commented 3 years ago

I'm also facing the same issue. Please find the debug log below.

=== Project Setup [info] [info] First, let's associate this project directory with a Firebase project. [info] You can create multiple project aliases by running firebase use --add, [info] but for now we'll just set up a default project. [info] [debug] [2021-01-25T08:48:03.977Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects pageSize=100 [debug] [2021-01-25T08:48:04.155Z] Failed to make request to https://firebase.googleapis.com/v1beta1/projects?pageSize=100 [debug] [2021-01-25T08:48:04.464Z] FirebaseError: Failed to make request to https://firebase.googleapis.com/v1beta1/projects?pageSize=100 at Client.doRequest (/usr/local/lib/node_modules/firebase-tools/lib/apiv2.js:194:19) at processTicksAndRejections (internal/process/task_queues.js:94:5) [error] [error] Error: Failed to list Firebase projects. See firebase-debug.log for more info.

michaelalhilly commented 3 years ago

@rajkumarboddu I solved this by simply adding the token generated with the firebase login command to the following environment variable: FIREBASE_TOKEN

bkendall commented 3 years ago

If you are having further issues listing projects, please open a new bug and follow the template. Thanks!