Firebase Warning: Using An Unspecified Index When Search Data With Firebase Cloud Function
I built a Firebase Cloud Function that looks for users who has value of 'IsNotificationEnabled' equal to true . Part of my Function export const sendPushNotification = functions.ht
Solution 1:
As the message says, you'll need to add the index to /Users
. You're now adding it one level lower, where it won't work.
{"rules":{"Users":{".indexOn":["IsNotificationEnabled"]},".read":true,".write":true}}
I find it easiest to remember where to define an index by thinking of where I run my query. Since your query runs on /Users
, you need to define your index on that level.
I also remove your .read
and .write
rules on /Users/$uid
, since they are ineffective. You're granting full read/write access at the root already, and permission cannot be taken away at a lower level.
Post a Comment for "Firebase Warning: Using An Unspecified Index When Search Data With Firebase Cloud Function"