Parse-SDK-JS icon indicating copy to clipboard operation
Parse-SDK-JS copied to clipboard

After calling `withCount` on `Parse.Query`, `findAll` returns empty array regardless of result

Open mdarens opened this issue 5 months ago • 1 comments

New Issue Checklist

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 countbatchSize 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

  1. Build a query that should have some results
  2. Call withCount(true) on the query
  3. 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

Logs

mdarens avatar May 21 '25 20:05 mdarens