firebase / firebase/firebase-js-sdk

Switching between emulator and production Firestore leads to unexpected behavior

Open
#4,111 1 comment 3 reactions 0 assignees View on GitHub
api: firestore needs-attention question
Dominant language
TypeScript
Stars
5.1k
Forks
1k
Avg merge
2d 21h
Merged PRs (30d)
37

Description

If you switch between the Firestore Emulator and a production Firestore instance on the same domain (say `localhost`) and have persistence enabled then you can get into some really gnarly state issues. This is not at all uncommon while doing local development. E.g, develop against the emulator and then target production for a sanity check before sending in your PR / deploying to production.

My suspicion is this is because Firestore is using the same IndexDB instance to store the persistence of the emulator and production states & understandably has issues resolving conflicts when switching between emulator and production. This often results in Firestore SDK not working at all and my having to manually delete the persistence data in developer tools to get things unstuck.

IMO we should implement a different IndexDB instance name when the Firestore SDK is not pointing at the production hostname.

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.