Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 367
Stiño Avatar asked Jun 29 '19 18:06

Stiño


3 Answers

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
like image 144
adius Avatar answered Oct 08 '22 15:10

adius


Just download the newest JDK version from here

like image 17
Austris Cirulnieks Avatar answered Oct 08 '22 15:10

Austris Cirulnieks


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.

like image 6
MarketerInCoderClothes Avatar answered Oct 08 '22 13:10

MarketerInCoderClothes