question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Firestore emulator hangs after clearFirestoreData or DELETE

See original GitHub issue

[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)

Issue Analytics

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

github_iconTop GitHub Comments

5reactions
tmazeikacommented, May 31, 2021

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.

0reactions
yuchenshicommented, Aug 25, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

Firebase Firestore Emulator Returning Data After Deletion?
I'm working on a React web app and I noticed some weird/unusual behavior when using the Firestore emulator.
Read more >
Connect your app to the Cloud Firestore Emulator - Firebase
Note: The Cloud Firestore emulator clears database contents when shut down. Since the offline cache of the Firestore SDK is not automatically cleared,...
Read more >
Testing security rules | Firestore - Google Cloud
To clear data between each test run, call the applicable clear emulator data method, e.g. clearFirestoreData , between tests. RulesTestEnvironment.
Read more >
Travis stuck after starting firestore emulator in python
I have python library and I write some test for firestore. Install firestore through travis it installed successfully and start but after ......
Read more >
Firestore rules testing on a custom port
In some situation you need to run the Firebase emulators on a different port than the default one. You can do that by...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found