Skip to content

afterDelete hook (on about to be deleted object) not being called from afterDelete hook? #2939

Closed

Description

@maqen

I get code that deletes a child object on afterDelete

I also have a hook for afterDelete on the child for a child child but that don't seems to be called?

Parse.Cloud.afterDelete('Grandparent', (request) => {
  var query = new Parse.Query('Parent');
  query.equalTo('grandparent', request.object.id);
  query.find().then((parents) => {
    return Parse.Object.destroyAll(parents, {useMasterKey: true});
  }).then(() => console.log('Removed all parents'));
});

Parse.Cloud.afterDelete('Parent', (request) => {
  var query = new Parse.Query('Child');
  query.equalTo('parent', request.object.id);
  query.find().then((children) => {
    return Parse.Object.destroyAll(children, {useMasterKey: true});
  }).then(() => console.log('Removed all children'));
});

Removed all children will never be called?

Activity

  1. changed the title [-]afterDelete hook (on about to be deleted object) not runned for from afterDelete?[/-] [+]afterDelete hook (on about to be deleted object) not runned from afterDelete hook?[/+] on Oct 26, 2016
  2. changed the title [-]afterDelete hook (on about to be deleted object) not runned from afterDelete hook?[/-] [+]afterDelete hook (on about to be deleted object) not being called from afterDelete hook?[/+] on Oct 26, 2016
  3. flovilmart commented on Oct 26, 2016

    @flovilmart
    Contributor

    Seems that you are using the wrong variable. parents vs connectors

  4. maqen commented on Oct 26, 2016

    @maqen
    Author

    @flovilmart thanks for spotting the example typo

    Looking through logs there are no actual calls for DELETE on Child only on Parent

  5. flovilmart commented on Oct 26, 2016

    @flovilmart
    Contributor

    how are you monitoring the logs? on a local server? output of you process?

  6. maqen commented on Oct 26, 2016

    @maqen
    Author

    Local server using verbose in setting up ParseServer

  7. flovilmart commented on Oct 26, 2016

    @flovilmart
    Contributor

    can you provide the full logs of this transaction?

  8. maqen commented on Oct 26, 2016

    @maqen
    Author

    So my error was passing request.object.id instead of request.object as this is a pointer field

    Sorry for the inconvenience and thanks @flovilmart for trying to help out

  9. flovilmart commented on Oct 26, 2016

    @flovilmart
    Contributor

    Eheh No problem! This is mostly why we ask for the logs when reporting the issue :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions