firebase / firebase/firebase-tools

Firestore emulator in datastore mode should support --import and emulator:export

Open
#7,883 11 comments 2 reactions 1 assignee Claimed by @harshyyy21 View on GitHub
emulators: firestore reproducible type: bug
Dominant language
TypeScript
Stars
4.5k
Forks
1.3k
Avg merge
1d 12h
Merged PRs (30d)
84

Description

### [REQUIRED] Environment info

**firebase-tools:**
I'm using the `gcloud` CLI :
```
$ /usr/lib64/google-cloud-sdk/platform/cloud-firestore-emulator/cloud_firestore_emulator --version
cloud-firestore-emulator 1.19.9
```

**Platform:**
```
Fedora Linux 40 (Workstation Edition)
```

### [REQUIRED] Test case

https://github.com/Nathanmalnoury/repro-firestore-emulator-datastore-mode-persistence

### [REQUIRED] Steps to reproduce

Included in test repo

### [REQUIRED] Expected behavior

I would expect to see saved data in my configured "--export-on-exit" folder, to then be able to import them on the next start via `--import-data`.

### [REQUIRED] Actual behavior

It stays empty when interrupting the emulator using `Ctrl + C`.

```
/Projects/test/building-an-app-3 (main ✔) gcloud emulators firestore start --database-mode datastore-mode --export-on-exit ./saved_data --host-port 0.0.0.0:8081 --project [PROJECT-ID] --verbosity debug

DEBUG: Running [gcloud.emulators.firestore.start] with arguments: [--database-mode: "datastore-mode", --export-on-exit: "./saved_data", --host-port: "", --project: "[PROJECT ID]", --verbosity: "debug"]
DEBUG: Found Cloud SDK root: /usr/lib64/google-cloud-sdk
Executing: /usr/lib64/google-cloud-sdk/platform/cloud-firestore-emulator/cloud_firestore_emulator start --host=0.0.0.0 --port=8081 --database-mode=datastore-mode --export-on-exit=./saved_data
[firestore] Oct 29, 2024 11:28:12 AM com.google.cloud.datastore.emulator.firestore.websocket.WebSocketServer start
[firestore] INFO: Started WebSocket server on ws://0.0.0.0:37901
[firestore] API endpoint: http://0.0.0.0:8081
[firestore] If you are using a library that supports the FIRESTORE_EMULATOR_HOST environment variable, run:
[firestore]
[firestore] export FIRESTORE_EMULATOR_HOST=0.0.0.0:8081
[firestore]
[firestore] If you are running a Firestore in Datastore Mode project, run:
[firestore]
[firestore] export DATASTORE_EMULATOR_HOST=0.0.0.0:8081
[firestore]
[firestore] Note: Support for Datastore Mode is in preview. If you encounter any bugs please file at https://github.com/firebase/firebase-tools/issues.
[firestore] Dev App Server is now running.
[firestore]
[firestore] Oct 29, 2024 11:28:51 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
[firestore] INFO: Detected HTTP/2 connection.
[firestore] Oct 29, 2024 11:28:51 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
[firestore] INFO: Detected HTTP/2 connection.
[firestore] Oct 29, 2024 11:28:52 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
[firestore] INFO: Detected HTTP/2 connection.
[firestore] Oct 29, 2024 11:28:52 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
[firestore] INFO: Detected HTTP/2 connection.
[firestore] Oct 29, 2024 11:28:52 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
[firestore] INFO: Detected HTTP/2 connection.
[firestore] Oct 29, 2024 11:28:53 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
[firestore] INFO: Detected HTTP/2 connection.
[firestore] Oct 29, 2024 11:28:53 AM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
[firestore] INFO: Detected HTTP/2 connection.
^C

Command killed by keyboard interrupt
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.