Parse.Cloud.afterSave in model class

@adammlevy Adammlevy
Tue, 27 May 2025 22:23:44 +0000

@rgunindi Sorry I just saw your response from some months ago.
Aside from the cloud functions I have defined in cloud/main.js, I am also defining cloud code functions outside of that file. For example I have one file as follows located in the models folder:

models/Incident.js

Parse.Cloud.afterSave("Incident", (request) => {
// do something after saving the object
}

This was working fine before updating to parse-server 3.0 but now that I have upgraded I see the following error when starting up my parse server:

TypeError: Parse.Cloud.afterSave is not a function

If I move the afterSave trigger to cloud/main.js then the error goes away and the afterSave trigger works. I want to avoid doing this since I have a lot of classes that share the same style of code and that would require me to move multiple afterSave triggers to main.js.