Firebase Cloud Functions emulator throws "exited with code: 1" error

Viewed 9254

I'm trying to setup my local environment for testing firebase cloud functions. I've followed along with their documentation but now bump into the following error:

Error: firestore: emulator has exited with code: 1

I've found other SO threads regarding this issue but none with my specific logs:

i  Starting emulators: ["functions","firestore","hosting"]
⚠  Your requested "node" version "8" doesn't match your global version "12"
✔  functions: Emulator started at http://localhost:5001
i  firestore: Logging to firestore-debug.log
✔  firestore: Emulator started at http://localhost:8080

Error: firestore: emulator has exited with code: 1

The firestore-debug.log file does not really hint me in a direction neither:

Exception in thread "main" java.lang.UnsupportedClassVersionError: com/google/cloud/datastore/emulator/firestore/CloudFirestore : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

Anyone here an idea what's causing this bug?

6 Answers

Just download the newest JDK version from here

In case anyone still struggles with this:

Run your emulators:start command again with --debug at the end to see why the process is crashing, right in the terminal.

On macOS 10.14 I needed to install the latest openjdk and enable it:

brew install openjdk

During installation it will then display instructions on how to enable the openjdk. For me it was:

For the system Java wrappers to find this JDK, symlink it with
  sudo ln -sfn \
    /usr/local/opt/openjdk/libexec/openjdk.jdk \
    /Library/Java/JavaVirtualMachines/openjdk.jdk

In addition of downloading JDK, I also needed to restart the computer.

It is more convenient to use AdoptOpenJDK installer for Windows to get the environment setup automatically.

How to install OpenJDK 11 on Windows?

https://adoptopenjdk.net/

You will still need to refresh your cmd or powershell to get access to the new environment variables PATH and JAVA_HOME the installer setup.

Related