firebase-tools: Firestore emulator hangs after clearFirestoreData or DELETE

[REQUIRED] Environment info

firebase-tools:

7.13.0

Platform:

$ uname -a
Linux 7u 5.4.5-050405-generic #201912181630 SMP Wed Dec 18 16:33:40 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

[REQUIRED] Test case

[REQUIRED] Steps to reproduce

Firestore emulator become unresponsive after clearing it’s DB using:

For example as part of mocha’s afterEach. If It’s enabled - I’m always getting timeout for 2nd test in a suit. If I skip DB clear - no timeouts.

Tests perform querying and setting/updating documents wrapped in transaction.

[REQUIRED] Expected behavior

Firestore emulator should process DB requests after clearing it up properly.

[REQUIRED] Actual behavior

Emulator started with --debug logs next errors:

✔  firestore: Emulator started at http://localhost:8080
i  firestore: For testing set FIRESTORE_EMULATOR_HOST=localhost:8080
✔  All emulators started, it is now safe to connect.
[2020-02-14T11:03:57.200Z] Feb 14, 2020 2:03:57 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected HTTP/2 connection.

[2020-02-14T11:03:57.754Z] Feb 14, 2020 2:03:57 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected HTTP/2 connection.

[2020-02-14T11:03:57.775Z] Feb 14, 2020 2:03:57 PM com.google.cloud.datastore.emulator.impl.util.WrappedStreamObserver onError
INFO: operation failed: the stored version (1581678237759003) does not match the required base version (0)

[2020-02-14T11:03:58.556Z] Feb 14, 2020 2:03:58 PM com.google.cloud.datastore.emulator.impl.util.WrappedStreamObserver onError
INFO: operation failed: the stored version (1581678237759003) does not match the required base version (0)

[2020-02-14T11:04:00.074Z] Feb 14, 2020 2:04:00 PM com.google.cloud.datastore.emulator.impl.util.WrappedStreamObserver onError
INFO: operation failed: the stored version (1581678237759003) does not match the required base version (0)

[2020-02-14T11:04:03.312Z] Feb 14, 2020 2:04:03 PM com.google.cloud.datastore.emulator.impl.util.WrappedStreamObserver onError
INFO: operation failed: the stored version (1581678237759003) does not match the required base version (0)

[2020-02-14T11:04:05.759Z] Feb 14, 2020 2:04:05 PM com.google.cloud.datastore.emulator.impl.util.WrappedStreamObserver onError
INFO: operation failed: the stored version (1581678237759003) does not match the required base version (0)

[2020-02-14T11:04:11.732Z] Feb 14, 2020 2:04:11 PM com.google.cloud.datastore.emulator.impl.util.WrappedStreamObserver onError
INFO: operation failed: the stored version (1581678237759003) does not match the required base version (0)

[2020-02-14T11:04:11.867Z] Feb 14, 2020 2:04:11 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
INFO: Detected HTTP/2 connection.

All attempts to perform requests to firestore after it produce same errors in emulator’s log and timeout on the client side:

Error: Timeout of 10000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/home/astar/dev/tvirl/develop/fb/functions/test/spec/app/iid/manager.spec.ts)
    at listOnTimeout (internal/timers.js:531:17)
    at processTimers (internal/timers.js:475:7)

Sometime there is error in the client log:

FirebaseError: 9 FAILED_PRECONDITION: the stored version (1581678549229005) does not match the required base version (0)
    at new FirestoreError (node_modules/@firebase/firestore/src/util/error.ts:166:5)
    at /home/astar/dev/tvirl/develop/fb/functions/node_modules/@firebase/firestore/src/platform_node/grpc_connection.ts:127:15
    at Object.onReceiveStatus (node_modules/grpc/src/client_interceptors.js:1210:9)
    at InterceptingListener._callNext (node_modules/grpc/src/client_interceptors.js:568:42)
    at InterceptingListener.onReceiveStatus (node_modules/grpc/src/client_interceptors.js:618:8)
    at callback (node_modules/grpc/src/client_interceptors.js:847:24)

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 6
  • Comments: 17 (9 by maintainers)

Most upvoted comments

I’m encountering a similar issue here (outside of @firebase/testing). Here’s a minimum complete verifiable example, @yuchenshi: https://github.com/tmazeika/1971mcve. Cheers.