Closed rodrigomata closed 6 years ago
I have a related Stack Overflow issue here: https://stackoverflow.com/questions/51814139/firestore-transaction-produces-console-error-failed-precondition-the-stored-ve . Hopefully a solution on either this issue or that question will lead to a solution on the other one.
What you are experiencing here is how Transactions work in Firestore: one of the transactions failed to write because the data has changed in the mean time, in this case Firestore re-runs the transaction again, until it succeeds. In the case of multiple Reviews being written at the same time some of them might need to be ran again after the first transaction because the data has changed. This is expected behavior and these errors should be taken more as warnings.
@nicolasgarnier is there a way to catch the error and handle it silently, instead of always printing it to the console? I tried using .catch on the promise, and wrapping everything into a try-catch, but it still always prints the 400 error to the console.
Error:
Clicking on Add Mock Ratings shows 400 error responses
Response:
{ "error": { "code": 400, "message": "the stored version (1531347069149658) does not match the required base version (1531346493121653)", "status": "FAILED_PRECONDITION" } }
Image:
Steps to reproduce:
EDIT: It only happens when more than 1 review is mocked