Best answer

Firebase/Zapier - orderBy issues/not finding recent records

  • 24 May 2022
  • 2 replies
  • 120 views

Hello!

I’m encountering the same issue discussed in this thread: 

When a new user is created in our web app, a child object is created in /users.  A timestamp is added to the object upon creation; it’s located in /users/$key/init-nurture-user-date/user-first-login

The $key is randomly assigned, so new objects can end up anywhere on the node.  So we are trying to use indexOn/orderBy to sort by that timestamp.

We’ve added indexOn to our Firebase RTDB rules.  However, I can only get Zapier to retrieve the results at the top or bottom of the node.  I cannot seem to get it to orderBy the timestamp @ /users/$key/init-nurture-user-date/user-first-login

Any ideas/suggestions would be greatly appreciated!

 

 

icon

Best answer by jesse 1 June 2022, 20:29

View original

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

2 replies

Userlevel 7
Badge +9

Hey @JSC1982, sorry to hear you’re running into some trouble here! It looks like you’re working with support on this one and that y’all are pretty in the weeds with getting to the bottom of this. Because if that, it’s best to continue your conversation there but please keep us posted with the resolution when you get to one! We’ll be keeping an eye on things as well. 😉

Userlevel 7
Badge +9

Hey @JSC1982! Just coming back to sum up some of the suggestions from our support team for you and anyone following along!

Firebase formatting details can be found here: https://zapier.com/help/doc/common-problems-firebase#error-empty-key-in-path-to-data-probably-tried-to-use-a-field-which-was-empty-as-part-of-the-path

I'm wondering if blank/nonexistent fields are being sorted to the top since a non-existent value could also be interpreted as "0". 
Would it be possible to backfill these blank ones with really high timestamps? So for example, 9999999999999 should be higher than every other timestamp and put it at the bottom of the list. 

I believe that Structured Queries are what the "New Document Within a Firestore Collection" trigger uses:
 

I don't think that's what you're looking for but I could be mistaken! To be totally transparent, I'm not fully aware of how FireBase works, so maybe that is an option for you.

It sounds like you were going to do some testing using a google sheet as the destination and then got this working! If you run into any other issues, feel free to create a new Community post or open up another support ticket for help. 🙂