I typically start my emulator like this:
firebase emulators:start --import=test/local-dev --export-on-exit=test/local-dev
The aim: import data that was previously exported into the local-dev folder, and save any data when the emulator exits.
Upon restarting my dev machine (macOS Catalina), I can no longer use the data in local-dev folder as the emulator fails to start with this console output:
firestore: Fatal error occurred:
Firestore Emulator has exited with code: 1,
stopping all running emulators
The contents of firestore-debug.log:
Exception in thread "main" com.google.cloud.datastore.core.exception.DatastoreException: Failed to parse overall export metadata file
at com.google.cloud.datastore.emulator.impl.ExportImportUtil.parseOverallMetadataFile(ExportImportUtil.java:229)
at com.google.cloud.datastore.emulator.impl.ExportImportUtil.fetchEntities(ExportImportUtil.java:56)
at com.google.cloud.datastore.emulator.firestore.CloudFirestore.main(CloudFirestore.java:89)
Caused by: java.io.FileNotFoundException: ~/project-root/test/local-dev/firestore_export/firestore_export.overall_export_metadata (No such file or directory)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at com.google.cloud.datastore.emulator.impl.ExportImportUtil.parseOverallMetadataFile(ExportImportUtil.java:219)
... 2 more
I noticed that the firestore_export
sub-folder that is typically in local-dev is missing:
$ ls test/local-dev/
firebase-export-metadata.json
It appears that the system shutdown process somehow corrupts the export folder. Any ideas how/why?