Firestore insert query - sometimes off-by-one?

Hi there, I have a form that triggers an insert query to push data into Firestore. Very occasionally, everything in this query is off-by-one. As a simplified example, I will attempt to submit:

restaurant-name: "Timmie's",
dish-name: "Donut",
price: 20

And what gets submitted is:

restaurant-name: null,
dish-name: "Timmie's",
price: "Donut"

Again, this happens rarely, but is a huge pain to clean up data-wise.

Has anyone else run into this issue before? Here is a screenshot of the actual value section of the query.

I have not seen this issue writing data to Firestore. To be fair none of my objects are that large, they usually only have a dozen or less properties in them. Everything there is hard-coded, so yeah, it's really confusing why your condition would happen.

Hey Andrew

That is definitely very strange, have you noticed any patterns to when this happens, or is it seemingly random? Also when you say 'very occasionally', about how often do you see this occurring?

One thing that you could try doing is having a JS query/transformer to construct the object which is then passed to the firebase query, to see if this is an issue with Retool's JS interpolation, or if it is an issue with our Firebase queries themselves.

Hi all - thanks for the responses. I'm just now coming back to this issue after it happened again recently on a production record. Mark, to answer your questions:

  • It seems random, I would say 1/50 submits? Hard to say exactly.

  • I've removed a few fields, reordered them in the query, added a debounce to the form submit recently in response to this issue. Haven't seen it since, but who knows!

Having a JS transformer construct the object is a good idea, I will do that next. My assumption is that it's something weird going on with Retool's JS interpolation but since I can't replicate this issue reliably it's been very hard to track down.

Yeah, it definitely seems like some oddity with the way that interpolation is being done, but without a consistent repro, it is very hard to track down. It is definitely possible that there was some sort of race condition occurring that the debounce, or even re-ordering the keys may have resolved. Glad to hear that it has been stable for you since making changes though.

If you do start seeing this more, or find a particular case where it consistently fails, definitely let me know. I will be happy to dig in more on this!