-
-
Notifications
You must be signed in to change notification settings - Fork 132
LiveQuery does not work with PFObjects secured with an ACL & when the where key has a Pointer #40
Comments
I solved the ACL issue by passing the sessionToken to the subscribe method of the live query protocol.
This worked and I was able to get changes about objects which have been secured with an ACL. |
I also solved the pointer issue by replacing:
with
in QueryEncoder.swift At this stage I was super excited that I for the first time could do a pull request to update this repo. But what I found was
I get.
This looks like the results are from a REST API. I then thought the above problem was due to me changing the So, I am still stuck with this problem. Was super excited about Live Queries but now I am confused. Any help will be much appreciated. |
It looks like the results you get there in the last code block have pointers to other objects. I would love to see your pull request anyways, that way other people can test it out / give feedback =) |
Hi @tsanthosh ! Thanks for this research, I'm facing the same issue (parse-community/parse-server#2227). Did you make a pull request yet? |
Hi @tsanthosh ! I tried your method of passing |
Hi Guys, My change of
is
I'm not sure if my solution when the The function
by
Finally, looks like Live Query Server ignores where options in queries that has a constraint. In my case I tried using the constraint |
I can not check what I said in my previous comments about what is going on with my request subscription, why the Server doesn't take in count the "notEqualTo" constraint. The request seems configured well, see below:
I can not check it because I can not succeed config the Parse Live Query with logs in VERBOSE mode. My configurations are as below:
Any help will be very welcome. Best! |
When will this be fixed :( |
Do we have anymore information on this? A lot of my databases use pointers and makes the Live Query quite unusable. |
@Treverr , likely be a while. Doesn't look like this repo is being actively supported :( |
The same for me. Result object from LiveQuery looks like REST API response object:
|
Can you try with the PR #76 ? You can use it directly with CocoaPods (Swift3)
|
Thanks, @flovilmart. It works. Now returns correct PFObject |
But includeKey is still not working for me. |
The includedKeys is likely a problem with parse server as we don't perform back inclusion when notifying for a change on a certain query. We match on the query constraints not on the additional portion like selectKeys, order étc... |
I think that the issues at files BoltsHelpers.swift and ClientPrivate.swift where fixed on tag '1.1.0'. On the other side the file QueryEncoder.swift still has not any change related the issue at serialization time with queries that has for example Less Than, see link. In this case I still use my fix, see below:
|
Did you open a Pull Request with the fix for the query encoding? |
I redirected my pod to the fix-object-decoding branch, and when I run my query query.whereKey("sender", notEqualTo: User.current()!), I am still getting the error "Invalid type in JSON write". I am kind of lost at this point, are there more necessary steps to take than just redirecting the Cocoapod? Thanks in advance. |
the |
Oh, so then is it still not currently possible to do a query on a pointer column (e.g. query.whereKey("sender", notEqualTo: User.current()!) ) ? |
it doesn't seem like it. PR are welcome |
@protspace Did you solve this problem? I got an exactly same problems. |
@yoshiboarder We hacked our way around it by creating a new column with the objectId of our pointer in text ¯\_(ツ)_/¯ |
@magneticrob good tip Thanks :) |
The problem seems to be server side in that case. Can you open the issue there with clear steps to reproduce? |
@flovilmart Open at #86 |
I think livequery is not support pointer object. Is it right? Here is my solution. I use fix-object-decoding. When I received live query event then called fetchIfNeeded() in event handler.
And I also use Cloud Function to receive events when changed Pointer Object. In my case, When I update PFUser then reset postBy in Post Class. I hope this will help. |
@yoshiboarder the only problem I still have is inconsistency between updated object arriving in LQ callback and current old object I have at this moment. Though objectId's of this objects are the same I have basically 2 different objects. SO what I do is just one extra step - query object with given objectId or fetching |
@protspace Do you means like this? <Post: 0x6080000b0800, objectId: w5qcfMCByF, localId: (null)> { When I change postText then I got update event via live query but different. <Post: 0x6100000b1be0, objectId: w5qcfMCByF, localId: (null)> { As you can see..PFUser:0x6080000e3100 and PFFile: 0x60800024c150 has changed to In my case, I had called fetching.. not query object with id, before I get data. :) |
my model is way mote complicated, but you got the main thing - updating "your" object from server manually |
ACL with current user works, but ACL with Role seems to doesn't works.... it's normal ? |
Hi , Any news regarding this issue? |
This is an issue with parse-server no? |
I guess so... according to your comments this is what i understand but anyway at the end the iOS client will use it... do you think we should move it to parse-server issues ? |
Yes most probably, the client is quite 'dumb' and has no matter in this behavior |
@flovilmart |
@tsanthosh Could you include do a pull request with your fix to allow the live querying of ACL secured objects? This would be an incredibly useful feature. |
@Charlesleonius I believe live querying of ACL secured objects is fixed now thanks to @andrew8712. Try v2.0.0. |
Role ACLs are not yet fixed, not working in my case... |
What do you mean by that? Open an issue on Parse-server and properly fill the template please. |
@flovilmart I actually opened one here - 4311 and then I found similar ones, like 106, 2018 and 349. In #2018 Parse guys actually suggest to fix it ourselves and submit a pull request, but the most interesting is #349 where I have commented myself several months ago and totally forgot about it. There I found the reason and will update 4311 that I created earlier today. Basic idea is the following - if _Role table is locked for master-key-only ACL then live query on objects protected by Role ACLs will fail. As a result I opened the Role table for public read and live queries started to work again, however I don't like this solution, want to keep Role table closed. |
Please, if it’s an issue on Parse server open it with all the informations required to fix it, as I see you didn’t fill the issue template either. |
We're in May 2018 and this is still an issue. Does anyone have a working fix for this? |
@Xenero not a working fix, but a working workaround - create a new column with the objectID in text, and use that for your LiveQuery. See my comment further up in the thread. It's ugly, but it works. |
@magneticrob thankyou for the suggestion, whilst this won't work for my instance because the data is extremely dynamic (i'm building a 'stories' system) and changes regularly I need something more robust. This lead me to creating a function that returns me the query as an array of objectId's like below. For now it works in eliminating the error.
The issue now is that it is not returning the notifier of any events. Any idea why this is and how I can fix it? |
@Xenero feel free to open a pull request with a fix on parse-server. Also the discussion as moved away from the original topic which was solved a while ago. Locking the conversation. |
Uh oh!
There was an error while loading. Please reload this page.
First, thanks to the Parse team for making Parse open source and enhancing it constantly.
Environment:
Parse-server index.js:
iOS Client:
Live Query does not work:
account
is a pointer, I get*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid type in JSON write'
.So far Live Query works:
Any help would be greatly appreciated.
The text was updated successfully, but these errors were encountered: