Pbopbo
Pbopbo

Reputation: 81

Firebase CLI always shows Error: Invalid project id: \

Every time I use a firebase command this error occurs:

...\WEBRTCTest\FirebaseRTC> firebase use --add

Error: Invalid project id: \.
\WEBRTCTest\FirebaseRTC> firebase use --clear

Error: Invalid project id: \.

The error occured after I accidently run the command:

firebase use \

Prior to that all was working fine.

I tried to reinstall firebase-tools using npm and also re-cloning the example project from github. Also tried to logout using firebase logout but it gives me the same error:

\WEBRTCTest\FirebaseRTC> firebase use --clear

Error: Invalid project id: \.

I´m thankful for any idea as i´m stuck right now.

Upvotes: 7

Views: 7168

Answers (8)

Sosho Chang
Sosho Chang

Reputation: 11

In my case where I am using Angular, I also had to change angular.json

{
    "projects": {
        "YOUR_PROJECT_ID": { ... }
    }
}   

Upvotes: 1

Kassio Gluten
Kassio Gluten

Reputation: 21

i had to delete the .firebaserc file ( to the all commands work again

Upvotes: 2

Curtis Otiende
Curtis Otiende

Reputation: 1

I came a cross this problem and realized that there was another firebase.js file in the same folder as my project folder. When I deleted that firebase file, boom! it worked. Just check to see that there is no other firebase.js file that could be read from apart from the one you intend to be read from.

Upvotes: 0

Senh Lee
Senh Lee

Reputation: 11

In my case, I changed the "default" in .firebaserc, then it works:

From:

{
    "projects": {
        "default": "YOUR DEFAULT PROJECT ID"
    }
}

TO my project id "pwa-proj"

{
    "projects": {
        "default": "pwa-proj"
    }
}

Upvotes: 1

hlynbech
hlynbech

Reputation: 692

It seems Firebase CLI can get into a bad state if you accidentally use an invalid project name, then all commands will fail, even firebase use --clear (I'm using version 8.2.0)

This happens even if there is no .firebaserc file.

I got it to work by finding a valid project name in my Firebase Console on console.firebase.google.com and then run the firebase command use --clear but overriding the active project with the --project parameter indicating a valid project name, like this:

$ firebase use --clear --project="myvalidprojectname"
Cleared active project.

Run firebase use --add to define a new project alias.

Then subsequent commands will run smoothly.

Upvotes: 17

Pbopbo
Pbopbo

Reputation: 81

Not sure why it works now. But I found a work-around: It´s working again after cloning the project in a new folder.

Upvotes: 1

Frank van Puffelen
Frank van Puffelen

Reputation: 598817

The Firebase CLI keeps information about the current project in a (hidden) file called .firebaserc. It looks like your .firebaserc file got corrupted, so you might want to delete the file and then run firebase use or firebase add again .

Upvotes: 0

Segev -CJ- Shmueli
Segev -CJ- Shmueli

Reputation: 1621

Have you considered explicitly telling firebase what project to use?


# get list of projects
$ firebase projects:list

# add project id to most firebase CLI commands 
$ firebase <my command> --project=<my project ID>

Upvotes: 1

Related Questions