I have been playing around with Firebase lately. If you don't know what it is, you should! In short, it is a set of services - Realtime Database, Storage, Static hosting, Authentication and more. Free for the first 100 concurrent users. Check it out here - https://firebase.google.com
Yesterday, as I was deploying a new version of a new project of mine, I got a message saying there is 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 is login 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 exactly my experience, but didn't help at all. My
.firebaserc file was configured correctly. Also,
firebase list displayed the right ID. So no luck here.
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 no where 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 - https://github.com/firebase/firebase-tools/blob/master/lib/getProjectId.js). Reading the source, it seems like there is an option to have more than one project ID to each project. And that 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:
- Check you are logged in correctly using
- Check the project ID in the
firebase listare correct.
firebase use projectId