-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FAILED_PRECONDITION when using where and orderBy together #515
Comments
@mackenziemance Can you add the snippet of code that you're running? Please include the |
|
@mackenziemance Have you tried the same query on Android to see what it does? I think this is a Firestore issue rather than an RNFirebase issue as we're just passing back the error we receive. |
@chrisbianca No but I will. I figured that was probably the case, just thought I’d see if anyone else had experienced this issue |
@mackenziemance I was also running into issues with |
@mackenziemance I had the same problem on Android. When I did |
Hey I'm getting the same thing on Android:
Is there any update on this? |
Oops, didn't try that yet, will do |
@chrisbianca |
Ok great. I'm going to close this as it's definitely a firebase SDK issue rather than RNFirebase. |
I am getting this error in the chrome console for iOS, but it does not print a URL to create the proper index. Where would I find that URL? |
@agersoncgps the URL won't show up on The line you're looking for should look like this:
|
Is there a particular reason that the URL for creating an index doesn't get passed to the error message on the js side? Edit: |
@noahtallen , I have tried the command |
It would be awesome if there was a way to get these errors (which include the index creation url) into the javascript console. Currently, you have to view them in XCode for iOS or using |
@cmmartin Same here |
In Xcode, click Target->Edit Scheme. |
I found this query needs indexes each tags, but according to https://firebase.google.com/docs/firestore/query-data/index-overview?hl=en#index_limitations, the compound index limit is 200. So, if we have these keys are id, it cannot be used to order records.Curiously, js-sdk can read with startAfter inputed to last documentReference, but [email protected] cannot. Is there any solution for this? |
For android users, you can use this command to view the url to create the composed index, since that's the error being presented when you try to use a where and order by in the same query: adb logcat | grep -F " |
@ardalahmet I tried that and still the Firebase Index Creation URL is still not showing in the XCode log. I am currently trying Project Clean + Installing on a different simulator. Will see if there's any luck. Any other ideas though? What version of react-native-firebase do you have? |
@technoplato , have you tried adding catch blocks in your query's promise result and debug via react-native debugger? I'm thinking that it should also give you the create index link. |
@leron8 Good suggestion. I didn't do that, but I did fix the error by creating an Index for my collectionGroup query. This article helped a ton: https://firebase.googleblog.com/2019/06/understanding-collection-group-queries.html |
@tkow There is a solution for queries that fail when |
@phatmann which version are you using? v6 has loads of fixes for Firestore queries, passing a document ref in was one. |
@Ehesp I am using v6. This same query worked fine with v5. |
I reached the auto-index-creator link by react-native log-android and the link was similar to this: In addition, if you will create index for map fields create like this:
create index as: myMap.`myElement`` (with one ' et the end) |
What should I replace '[:space:]' with ?? |
@Yash1511 if I am not mistaken that is a 'tr' command expression syntax way of saying literally "a space character", you don't need to replace it http://www.softpanorama.org/Tools/tr.shtml |
Okay, thank you! |
@Yash1511 have you tried this?: The code would be something like this: and also use the query's error callback: |
I had the exact same issue and this fixed it. I didn't get any error but I found it in adb logcat. Thanks! |
Thanks, I fixed it |
08-12 12:36:32.040 13843 15800 W Firestore:
worked for me, Thanks |
When querying a collection with .where().orderBy() I get the FAILED_PRECONDITION error code. I've tried orderBy before where and querying different collections all instances produce this err for me. Both methods work on there own. Can someone reproduce ?
Dev Tools output
Environment
macOS: High Sierra
Xcode: 9.0
react-native: 0.48.4
react-native-firebase: 3.0.3
The text was updated successfully, but these errors were encountered: