Yesterday, as I was deploying a new version of a new project of mine, I got a message saying there was a new firebase-tools available. I, being the "if it works, an update will make it work better" kind of guy, immediately installed the update — which came with an interesting catch! I could no longer deploy my project. The error I got was this:

Error: The entered credentials were incorrect.  


Well, that's easy! All I need to do is log in again. firebase login didn't really help. I was already logged in. Logging out (firebase logout) and logging back in didn't do the trick either.

I found this bug — https://github.com/firebase/firebase-tools/issues/166 — which describes my experience exactly, but it didn't help at all. My .firebaserc file was configured correctly. Also, firebase list displayed the right ID. So no luck here.

Running firebase deploy --debug has made it clear why it doesn't work — it was trying to deploy to an old project ID, which I no longer use and was nowhere to be found in any of my configuration files. A problem!

The solution was found deep in the source code of firebase-tools (this file to be exact). Reading the source, it seems like there is an option to have more than one project ID to each project. And you can set which project you are using right now using the firebase use $projectId command. Running this command with the correct project ID solved the problem.

So, in case you have the same problem:

  1. Check you are logged in correctly using firebase login
  2. Check the project ID in the .firebaserc file and firebase list are correct.
  3. run firebase use projectId
  4. ??????
  5. Profit!