How to solve your current Firebase Admin SDK Issues

Note: the title of this blog post refers to a piece of paper that fell out of the box when I first installed Master of Magic, an MS-DOS fantasy game derived from Master of Orion. Both games were absolute classics of their time, but Master of Magic came with a slip of paper, clearly inserted at the last moment before shipping entitled “How to solve your current memory management problem” which kind of summed up (just in a heading) just what a miserable experience dealing with DOS was.

Firebase is actually pretty awesome. I love it.

If you were to list all the things I don’t really know how to do and don’t really want to learn how to do about building a cloud-based application that scales well to, say, millions of active users, Firebase gives you this in a neat box that Just Works, while letting you do the fun stuff (e.g. building the front end and writing “lambda” functions that scale with demand) with a minimum of fuss at a price that’s basically “free until you have enough users that you can probably get some funding”.

It’s the Macintosh of back-end systems.

But if there’s one aspect of Firebase that consistently causes me pain, it’s firebase-tools. On two occasions now I’ve had an issue with firebase-tools that makes no sense and gets me spiraling down to the “do I even know how to code?” “does the compiler work?” level of debug despair usually reserved for simple typos that are right in front of you the whole time that somehow evaded every lint tool and compiler warning you endure for the sole purpose of not having to do this.

Both problems turn out to have been solved the exact same way, so I’ll list the steps here. This was written on May 16 2023 at 2:41PM Helsinki Time for what that’s worth.

  1. completely uninstall firebase-tools, e.g.
    sudo npm uninstall -g firebase-tools
    curl -sL | uninstall=true bash
  2. Blow away the firebase cache, e.g. on a Mac:
    rm -rf ~/.cache/firebase
  3. Reinstall firebase-tools
  4. Update your Java runtimehere’s a good place to start looking.

(If you’re using parceljs may I recommend blowing away parcel’s cache?)

You should be done.

The most important and least obvious step is blowing away the firebase cache. It’s quite possible that this alone will solve your problem if you’re pretty religious about keeping stuff up-to-date (I am, but I have a blindspot where java is concerned).

The two problems this has solved for me so far are completely and utterly different problems. One was that the firestore emulator suddenly (i.e. with no apparent changes) stopped getting user information in the request causing all permissions to fail, while the other problem with the sign-in-with-google auth emulator suddenly just stopped registering clicks owing to a syntax error in its client-side Javascript payload. Both bugs made zero sense to me whatsoever.

This also solved a bunch of problems another engineer was having.