Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replicate firestore not replicating correctly #6064

Open
marnec opened this issue Jun 2, 2024 · 3 comments
Open

replicate firestore not replicating correctly #6064

marnec opened this issue Jun 2, 2024 · 3 comments
Labels

Comments

@marnec
Copy link

marnec commented Jun 2, 2024

I can't create a working pull request because this bug requires a firestore database;

I have a minimal Angular test PWA that instantiates a single collection called inbox with Dexiejs

after awaiting creation and migration, I start the firestore replication:

this.rxDatabase = await createRxDatabase<...>(...);
const collections = await this.rxDatabase.addCollections({...});
if (collections.inbox.migrationNeeded()) await collections.inbox.startMigration(10);

const replicationState = replicateFirestore({
    collection: collections.inbox,
    replicationIdentifier: 'inbox',
    autoStart: true,
    live: true,
    pull: {},
    push: {},
    firestore: {
        database: this.firestore,
        collection: collection(this.firestore, 'inbox'),
        projectId: environment.firebase.appId
    },
})

documents in firebase have the serverTimestamp correctly filled, and the serverTimestamp property is not added to RxJsonSchema of the document as per documentation

the replication shows the following behaviours:

  • firestore:
    • First-time replication works, existing documents in firestore are pulled, existing documents in local-db are pushed
    • Subsequently, only push operations work (from browser to firestore and from the pwa installed on a phone to firestore), while pull operations don't work
    • If I restart the development environment not even first-time replication works
    • Only by changing the replicationIdentifier property, first-time replication works again once
    • By inspecting the network the replication system is continuosly opening and closing subscription to firestore

firestore_subs_loop

  • firestore emulator:
    • First-time replication does not work completely, existing documents in local-db are not pushed but existing documents in firestore are pulled correctly
    • Subsequently pull and push operations work correctly
    • The replication system correctly opens a subscription to firestore and keeps it open

I looked online, read the discord and tried many different configuration but I can't get it working

@pubkey
Copy link
Owner

pubkey commented Jun 2, 2024

Shouldnt it be possible to make a PR with a test that shows the failing emulator behavior?

@marnec
Copy link
Author

marnec commented Jun 3, 2024

Shouldnt it be possible to make a PR with a test that shows the failing emulator behavior?

Yes I'll try as soon as possible, thanks for the quick reply

@marnec marnec mentioned this issue Jun 3, 2024
Copy link

stale bot commented Jun 10, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed soon. Please update it or it may be closed to keep our repository organized. The best way is to add some more information or make a pull request with a test case. Also you might get help in fixing it at the RxDB Community Chat If you know you will continue working on this, just write any message to the issue (like "ping") to remove the stale tag.

@stale stale bot added the stale label Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants