Reputation: 6781
I currently have a Facebook only login system. I want to attach a PublicUser
object to my _User
object, only upon first creation of the _User. I want to do this in my cloud code. As a precursor to my goal, I tried to come up with a quick way to see if afterSave
is working:
Parse.Cloud.afterSave(Parse.User, function(request) {
var PublicUser = Parse.Object.extend("PublicUser");
var publicUser = new PublicUser()
publicUser.save();
});
However, no publicUser object was created. Thanks in advance for the help!
Upvotes: 0
Views: 21
Reputation: 1457
Your code is fine, I checked it on my own project. Also check this thread about a similar question to see the same.
A few things you should check:
Make sure the code is actually deployed. You can check that via Parse Control Panel -> Your App -> Core -> Cloud code. Make sure the code is actually there. Sometimes (especially if your developing using "parse develop
") cli command, you will not see compilation errors when parse is trying to upload files and fails.
Make sure your trigger is imported to main.js
via require()
command. So if you saved your trigger in 'cloud/triggers/user.js' you should require('cloud/triggers/user.js') to make Parse aware of this code.
Finally, you should definitely use the oldest debugging technique in the book, and place console.log()
statements in there. You can read console out via running parse develop to check
Upvotes: 1