Skip to content

afterLiveQueryEvent hook returns empty date object #7082

@NuclleaR

Description

@NuclleaR

New Issue Checklist

Issue Description

Date object is empty in afterLiveQueryEvent hook.

Steps to reproduce

Created hook

Parse.Cloud.afterLiveQueryEvent('Spendings', async function(request) {
  const category = await getCategory(request.object.get('category'));
  const store = await getStore(request.object.get('store'));

  console.log('===> request.object', JSON.stringify(request.object));

  request.object.set('category', category);
  request.object.set('store', store);
});

Actual Outcome

log that I received. date is empty
===> request.object {"date":{},"amount":444,"createdAt":"2020-12-18T13:21:49.770Z","category":{"__type":"Pointer","className":"Categories","objectId":"SREwh7FEwF"},"parent":{"__type":"Pointer","className":"ParentCategory","objectId":"yomXRG8Hcj"},"updatedAt":"2020-12-18T13:21:49.770Z","objectId":"3MdGVC5NuY"}

Expected Outcome

expected date object

Failing Test Case / Pull Request

  • 🧐 I submitted a PR with a failing test case.
  • 🤩 I submitted a PR with a fix and a test case.

Environment

Server

  • Parse Server version: 4.5.0
  • Operating system: OSX 11.0.1
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): Local
  • NodeJs: v14.0.0

Database

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

Client

  • SDK (iOS, Android, JavaScript, PHP, Unity, etc): Flutter SDK
  • SDK version: 2.0.1

Logs

info: beforeSave triggered for Spendings for user undefined:
  Input: {"amount":444,"date":{"__type":"Date","iso":"2020-12-18T13:21:40.088Z"},"category":{"__type":"Pointer","className":"Categories","objectId":"SREwh7FEwF"},"parent":{"__type":"Pointer","className":"ParentCategory","objectId":"yomXRG8Hcj"}}
  Result: {"object":{"date":{"__type":"Date","iso":"2020-12-18T13:21:40.088Z"},"amount":444,"category":{"__type":"Pointer","className":"Categories","objectId":"SREwh7FEwF"},"parent":{"__type":"Pointer","className":"ParentCategory","objectId":"yomXRG8Hcj"}}} {"className":"Spendings","triggerType":"beforeSave"}
info: afterSave triggered for Spendings for user undefined:
  Input: {"date":{"__type":"Date","iso":"2020-12-18T13:21:40.088Z"},"amount":444,"createdAt":"2020-12-18T13:21:49.770Z","category":{"__type":"Pointer","className":"Categories","objectId":"SREwh7FEwF"},"parent":{"__type":"Pointer","className":"ParentCategory","objectId":"yomXRG8Hcj"},"updatedAt":"2020-12-18T13:21:49.770Z","objectId":"3MdGVC5NuY"} {"className":"Spendings","triggerType":"afterSave"}
===> request.object {"date":{},"amount":444,"createdAt":"2020-12-18T13:21:49.770Z","category":{"__type":"Pointer","className":"Categories","objectId":"SREwh7FEwF"},"parent":{"__type":"Pointer","className":"ParentCategory","objectId":"yomXRG8Hcj"},"updatedAt":"2020-12-18T13:21:49.770Z","objectId":"3MdGVC5NuY"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    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