Open
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
Objects returned by Cloud functions may cause the client to return stale data when used with deleted fields.
Steps to reproduce
- Suppose there is a collection
Item
with optional String-fieldlabel
- Suppose that collection initially contains one Item with
label: 'foobar'
- Suppose there is a cloud function
listItems
that returns the list of items, ie.
Parse.Cloud.define('listItems', async req => await (new Parse.Query(Parse.Object.extend('Item'))).find())
- Call that cloud function and list the item's labels, ie.
(await Parse.Cloud.run('listItems')).map(item => item.get('label')) ==> [ 'foobar' ]
- In Parse dashboard, delete the label of that one Item so that its value becomes undefined
- Call that cloud code function again, without invalidating the client cache (without reloading the browser page):
(await Parse.Cloud.run('listItems')).map(item => item.get('label')) ==> [ 'foobar' ]
Actual Outcome
(await Parse.Cloud.run('listItems')).map(item => item.get('label')) ==> [ 'foobar' ]
Expected Outcome
(await Parse.Cloud.run('listItems')).map(item => item.get('label')) ==> [ undefined ]
Environment
Server
- Parse Server version: master / 4.5.0
- Operating system: Linux
- Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): local
Database
- System (MongoDB or Postgres): MongoDB
- Database version: 4.2.8
- Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): local
Client
- Parse JS SDK version: 3.2.0
Logs
It is observable that the second response does not include "label": "foobar"
(or just "label"
) in its response.