Direct Firestore "add", "update", etc. calls fails when signed in
See original GitHub issueI’ve been updating a project of mine (which uses react-redux-firebase) from firebase to firestore.
So far so good. I’ve got the sign in system working, and have the data querying code working fine. (as far as I’ve tested anyway)
I’m now trying to reimplement the data saving/storing code. Because I prefer the direct route for storing data rather than the redux “action” system, I’m using code like this:
store.firebase.firestore().collection("users").add({
first: "Ada",
last: "Lovelace",
born: 1815
}).then(()=>console.log("Done")).catch(err=>console.log("Error: " + err))
The code above works perfectly when I am not signed in. When I’m signed in, however, the code snippet does nothing. It just returns a promise which never completes.
If I sign back out, it starts working again. If I sign back in, it stops working.
Any idea what could be causing these direct calls to fail?
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Firestore: Updating a document results in no success or failure ...
When I try to update a document, I get neither a success, or a failure from firebase. I am on a corporate proxy,...
Read more >Transactions and batched writes | Firestore - Firebase - Google
Updating data with transactions. Passing information out of transactions; Transaction failure. Batched writes; Data validation for atomic operations.
Read more >firebase - Query a single document from Firestore in Flutter ...
It can't be that hard to get data from a single document. UPDATE: Firestore.instance.collection('COLLECTION').document('ID') .
Read more >Firebase Cloud Firestore Querying Filtering Data for Web
In this Firestore tutorial, I will be covering how to do a simple CRUD (Create, Read, Update and Delete) operations with Firestore Database....
Read more >How to use Firebase v9 with React (setup, authentication and ...
Go to the Firebase Console and click Add project. ... in your project called firestore.js and add the following (using your values of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I went ahead and submitted a bug-report. (at https://firebase.google.com/support/contact/bugs-features)
It’s possible the issue only comes up in particular circumstances, however. (it’s a bit hard to believe they let an issue that large pass testing)
Can someone check if the issue occurs in your project as well – update failing for non-existent paths, but giving no error or warning message? (and furthermore, blocking later requests if 10+ of these failed calls occur)
Just run this code:
If the issue occurs in your project as well, then the “Valid call was not blocked!” message will never show.
Anyway, I’ll close the issue since it appears to not be a problem with
redux-firestore
specifically.I appear to have found the cause:
The code above was set to run as soon as the user logged in (for the first time). However, it used the “update” function instead of the “set” function. Using firebase, the same code worked, even if the userExtra/USERID path did not exist yet; however, this version seems to fail if the path does not exist.
Therefore, the calls would get sent to firestore, but firestore either wouldn’t respond, or the response was not handled correctly, causing the request to never get removed from the request-buffer (in Network dev-tools, it appears the request was sent and a suitable response; however, the breakpoints were never hit for the code that processes the responses – even as far back as I could trace the standard stack-trace).
Since the request-buffer has a max length of 10, it would then get full and block further calls.
Everything works as expected when the code is changed to use “set”: (with “merge” set to true)
To me, this appears to be a bug in Firestore’s web-client. If the “update” call fails to run because the path does not exist, the client should raise some sort of warning or error. Or at the very least, remove the call from the buffer, so that later calls can pass through.