I created a query to return results around a GeoPoint and it works perfect except that live queries crashes with the same query when a new client connects to it.
const userLoc = new Parse.GeoPoint({ latitude, longitude })
const Park = Parse.Object.extend('Park')
const query = new Parse.Query(Park)
query.near('location', userLoc)
const parks = await query.find() // this returns the results perfectly
// ------------------------
const suscription = query.subscribe()
suscription.on('update', console.log) // this works only if is the first client connected that matches the query. Once a second one connects, the parse-server logs returns the following:
Multiple clients suscribes to the same query without issues
Server crashes when more than one client query Is matched and subscribed. This happens ONLY if the query.near is added. If no GeoPoint added to the query, it works perfect.
Server
Database
2017-05-23T09:27:30.668557+00:00 app[web.1]: TypeError: Cannot read property 'latitude' of undefined
2017-05-23T09:27:30.668559+00:00 app[web.1]: at ParseGeoPoint.value (/app/node_modules/parse-server/node_modules/parse/lib/node/ParseGeoPoint.js:115:26)
2017-05-23T09:27:30.668559+00:00 app[web.1]: at matchesKeyConstraints (/app/node_modules/parse-server/lib/LiveQuery/QueryTools.js:263:34)
2017-05-23T09:27:30.668560+00:00 app[web.1]: at matchesQuery (/app/node_modules/parse-server/lib/LiveQuery/QueryTools.js:111:10)
2017-05-23T09:27:30.668561+00:00 app[web.1]: at _loop3 (/app/node_modules/parse-server/lib/LiveQuery/ParseLiveQueryServer.js:314:53)
2017-05-23T09:27:30.668560+00:00 app[web.1]: at ParseLiveQueryServer._matchesSubscription (/app/node_modules/parse-server/lib/LiveQuery/ParseLiveQueryServer.js:546:43)
2017-05-23T09:27:30.668561+00:00 app[web.1]: at ParseLiveQueryServer._onAfterSave (/app/node_modules/parse-server/lib/LiveQuery/ParseLiveQueryServer.js:425:11)
2017-05-23T09:27:30.668561+00:00 app[web.1]: at Subscriber.<anonymous> (/app/node_modules/parse-server/lib/LiveQuery/ParseLiveQueryServer.js:123:15)
2017-05-23T09:27:30.668564+00:00 app[web.1]: at emitTwo (events.js:106:13)
2017-05-23T09:27:30.668564+00:00 app[web.1]: at Subscriber.emit (events.js:194:7)
2017-05-23T09:27:30.668565+00:00 app[web.1]: at EventEmitter.handler (/app/node_modules/parse-server/lib/Adapters/PubSub/EventEmitterPubSub.js:60:16)
Many thanks!!
Thanks for reporting the issue, we'll have a look shortly!
Can I help here @flovilmart ?
I could yes! Dropped the ball on this one, could you as well?
I will look this. 馃憤
@paulovitin what version of parse-server are you running?
@flovilmart None yet. I will check with the version 2.4.0 and the current version.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.