-
-
Notifications
You must be signed in to change notification settings - Fork 598
Description
New Issue Checklist
- I am not disclosing a vulnerability.
- I am not just asking a question.
- I have searched through existing issues.
- I can reproduce the issue with the latest versions of Parse Server and the Parse JS SDK.
Issue Description
When building a query dynamically, if withCount
is called before findAll
, the request payload sent over REST just looks like that for a regular find
query with count
— batchSize
is not sent as the limit, and no subsequent requests are sent with an object id cursor. Even if results come back, the SDK returns an empty array to the caller and fails silently. This appears to have regressed in the SDK at some point between 4.1.0 (where this was working previously) and 6.1.1 (where I encountered it), but I haven't pinpointed it further than that. Obviously if one is using findAll
they can just use the size of the result to get the count, but this is definitely unexpected behavior. My workaround in app code is to call withCount
conditionally exclusive to the condition for calling findAll
.
Steps to reproduce
- Build a query that should have some results
- Call
withCount(true)
on the query - Await
findAll
on the query
Actual Outcome
The result is an empty array despite the results appearing in the network tab
Expected Outcome
findAll ignores withCount
when building the query, but shapes the result to match the expectation of calling with count: { count: number; results: Parse.Object<T>[] }
Environment
Chrome 136.0.7103.114 (Official Build) (arm64)
Parse JS SDK: 6.1.1
Parse Server: 8.2.0
Node: LTS 20.19.2
Server
- Parse Server version: 8.2.0
- Operating system: alpine Linux
- Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): Google Cloud
Database
- System (MongoDB or Postgres): MongoDB
- Database version: 6.0.23
- Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): Google Cloud
Client
- Parse JS SDK version: 6.1.1