parse-server icon indicating copy to clipboard operation
parse-server copied to clipboard

[Live Query] `matchesKeyConstraints` throwing error when `constraints` is `{$ne : null}`

Open RahulLanjewar93 opened this issue 1 year ago • 7 comments

New Issue Checklist

Issue Description

matchesKeyConstraints function is not handling not equal to null constraint properly. Due to which error is thrown `Cannot read properties of null (reading '__type')

image

Steps to reproduce

Create a subscription on a class with constraint notEqualTo(key,null)

Actual Outcome

Throws error.

Expected Outcome

Shouldn't throw an error.

Environment

18.19.0

Server

  • Parse Server version: 5.5.5
  • Operating system: Mac
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): self hosted

Database

  • System (MongoDB or Postgres): Mongo
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): Local

Client

  • SDK (iOS, Android, JavaScript, PHP, Unity, etc): Javascript
  • SDK version: 4.0.1

Logs

RahulLanjewar93 avatar Dec 14 '23 08:12 RahulLanjewar93

Thanks for opening this issue!

  • 🚀 You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.

@mtrezza i think we need some changes in the code block

QueryTools.js > matchesKeyConstraints

image

here we need to check if compareTo is not null/undefined

RahulLanjewar93 avatar Dec 14 '23 09:12 RahulLanjewar93

@mtrezza please have a look

RahulLanjewar93 avatar Dec 14 '23 09:12 RahulLanjewar93

Will this issue be fixed by https://github.com/parse-community/Parse-SDK-JS/pull/2102 once the Parse SDK is upgraded in Parse Server? @dplewis

mtrezza avatar May 16 '24 18:05 mtrezza

@mtrezza Thats a fix for the Local Datastore this issue is for LiveQuery. The query engines for both are almost the same. You can basically copy the fix over to Parse Server and it should work for Live Query.

dplewis avatar May 16 '24 18:05 dplewis

@RahulLanjewar93 do you want to give it a try?

mtrezza avatar May 16 '24 20:05 mtrezza

@RahulLanjewar93 do you want to give it a try?

sure!

RahulLanjewar93 avatar May 26 '24 17:05 RahulLanjewar93

@RahulLanjewar93 do you want to give it a try?

added required change in #8835

RahulLanjewar93 avatar May 31 '24 15:05 RahulLanjewar93

🎉 This change has been released in version 7.1.0-alpha.10

parseplatformorg avatar Jun 11 '24 19:06 parseplatformorg

🎉 This change has been released in version 7.1.0-beta.1

parseplatformorg avatar Jun 30 '24 02:06 parseplatformorg

🎉 This change has been released in version 7.1.0

parseplatformorg avatar Jun 30 '24 02:06 parseplatformorg