Skip to content

Don't overwrite cloud triggers. #21

Description

@RahulLanjewar93

parseSDK.Cloud.afterSave(c, async req => audit(req.user, 'SAVE', c, req.object, config));
parseSDK.Cloud.afterDelete(c, async req => audit(req.user, 'DELETE', c, req.object, config));

parseSDK.Cloud.afterFind(c, async (req) => {
req.objects.forEach(async object => audit(req.user, 'FIND', c, object, config));
return req.objects;
});

The above lines, works if there are no exisiting cloud triggers for the given class.
If the cloud triggers already exists, it will apply the most the recent cloud trigger. If i had my own afterSave trigger registered before calling ParseAuditor, it will be overwritten by the triggers defined by ParseAuditor

I think we need to expose functions that can be called in cloud triggers for this to work fine.
example :- auditSaveRequests(req),auditDeleteRequests(req),auditFindRequests(req)

Steps to reproduce :-

cloud/main.js
ParseAuditor(['Zone'], ['Zone'])

Terminal output :-

warn: Warning: Duplicate cloud functions exist for Zone. Only the last one will be used and the others will be ignored.
warn: Warning: Duplicate cloud functions exist for Zone. Only the last one will be used and the others will be ignored.
warn: Warning: Duplicate cloud functions exist for Zone. Only the last one will be used and the others will be ignored.

Activity

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