Skip to content

runTransaction after clearFirestoreData fails #3977

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

Closed
lovebug356 opened this issue Oct 22, 2020 · 4 comments
Closed

runTransaction after clearFirestoreData fails #3977

lovebug356 opened this issue Oct 22, 2020 · 4 comments

Comments

@lovebug356
Copy link

lovebug356 commented Oct 22, 2020

[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"}}

@google-oss-bot
Copy link
Contributor

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@schmidt-sebastian
Copy link
Contributor

schmidt-sebastian commented Oct 28, 2020

@lovebug356 Thanks for filing this. The error message you are seeing is actually from the Emulator. The code snippet you provided should work, so I would be interested in your client logs. These logs will contain all communication with the emulator.

You can enable logging by invoking firebase.firestore.setLogLevel('debug').

Thank you for your help!

@google-oss-bot
Copy link
Contributor

Hey @lovebug356. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

@google-oss-bot
Copy link
Contributor

Since there haven't been any recent updates here, I am going to close this issue.

@lovebug356 if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

@firebase firebase locked and limited conversation to collaborators Dec 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants