-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Closed
Description
I tried to trigger a request inside the afterSave function in cloud code. But it throws an error like the user is undefined.
In the afterSave function, I have code like this,
Parse.Cloud.afterSave("ClassName", function(request) {
var objectId = request.object.id;
Parse.Cloud.httpRequest({
method: 'POST',
url: URL,
headers: {
headers
},
body: {
body
}
}).then(function(httpResponse) {
console.log('ResponseText is : ' + httpResponse.text);
}, function(httpResponse) {
console.error('Request failed with response code ' + httpResponse.status);
});
It returns an error.
info: afterSave triggered for AudioFile for user undefined:
Input: {input,"createdAt":"2017-01-11T11:15:54.128Z","updatedAt":"2017-01-11T11:15:54.128Z","objectId":objected} className=ClassName, triggerType=afterSave, user=undefined
ResponseText is :
I have added Parse.Cloud.useMasterKey(); inside the afterSave function. But it returns the same error only.
Any help is much appreciated. Thanks.
Metadata
Metadata
Assignees
Labels
No labels