Skip to content

runTransaction after clearFirestoreData fails #3977

@lovebug356

Description

@lovebug356

[REQUIRED] Describe your environment

  • Operating System version: Archlinux
  • Browser version: Chrome
  • Firebase SDK version: git
  • Firebase Product: rules-unit-testing

[REQUIRED] Describe the problem

When clearFirestoreData is called, runTransaction does not work anymore.

Steps to reproduce:

When I add the following test case, it fails. I would expect that I can use a transaction after clearFirestoreData.

lovebug356@9b6b0b3

 it('should allow transaction after clearFirestoreData', async function() {
    await firebase.clearFirestoreData({
      projectId: 'foo'
    })
    const app = firebase.initializeTestApp({
      projectId: 'foo',
    });

    const doc = app.firestore().doc('test/test');
    await firebase.assertSucceeds(
      app.firestore().runTransaction(async (transaction) => {
        await transaction.get(doc);
      })
    );
  })

In the logs,
{"metadata":{"emulator":{"name":"firestore"},"message":"Oct 22, 2020 2:29:52 PM com.google.cloud.datastore.emulator.impl.util.WrappedStreamObserver onError\nINFO: operation failed: the stored version (1603369765688732) does not match the required base version (0)\n"}} [2020-10-22T12:29:54.916Z] Oct 22, 2020 2:29:54 PM com.google.cloud.datastore.emulator.impl.util.WrappedStreamObserver onError INFO: operation failed: the stored version (1603369765688732) does not match the required base version (0) {"metadata":{"emulator":{"name":"firestore"},"message":"Oct 22, 2020 2:29:54 PM com.google.cloud.datastore.emulator.impl.util.WrappedStreamObserver onError\nINFO: operation failed: the stored version (1603369765688732) does not match the required base version (0)\n"}} [2020-10-22T12:29:55.003Z] Oct 22, 2020 2:29:55 PM com.google.cloud.datastore.emulator.impl.util.WrappedStreamObserver onError INFO: operation failed: the stored version (1603369765688732) does not match the required base version (0) {"metadata":{"emulator":{"name":"firestore"},"message":"Oct 22, 2020 2:29:55 PM com.google.cloud.datastore.emulator.impl.util.WrappedStreamObserver onError\nINFO: operation failed: the stored version (1603369765688732) does not match the required base version (0)\n"}}

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions