Skip to content

Stale data with Cloud functions and deleted fields #1347

Open
@aforemny

Description

@aforemny

New Issue Checklist

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-field label
  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bounty:$10Bounty applies for fixing this issue (Parse Bounty Program)type:bugImpaired feature or lacking behavior that is likely assumed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions