Skip to content

Commit 686cc4a

Browse files
simonas-notcatflovilmart
authored andcommitted
Checking if object has defined key for Pointer constraints in liveQuery
* Removing sessionToken and authData from _User objects included in a query This bug caused sessionToken to be replaced on client side to some old sessionToken from DB. * Removing dangling variable that is never used * Checking if object has defined key for Pointer constraints in liveQuery If there is a liveQuery subscription, with Pointer type constrains (e.g query.equalTo('user', Parse.User.current())), and new object has undefined value for that field, we get this error: error: Uncaught internal server error. [TypeError: Cannot read property 'className' of undefined] TypeError: Cannot read property 'className' of undefined at matchesKeyConstraints (…/node_modules/parse-server/lib/LiveQuery/QueryTools.js:145:51)
1 parent fc1cdd4 commit 686cc4a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/LiveQuery/QueryTools.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ function matchesKeyConstraints(object, key, constraints) {
141141
if (constraints.__type) {
142142
if (constraints.__type === 'Pointer') {
143143
return (
144+
typeof object[key] !== 'undefined' &&
144145
constraints.className === object[key].className &&
145146
constraints.objectId === object[key].objectId
146147
);

0 commit comments

Comments
 (0)