You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
@newdev7 usage of Parse.Cloud.useMasterKey(); is unavailable in Parse server, as you noted. Pass {useMasterKey: true} instead. Read more here.
Besides that, it's not an error that user is undefined, it's just an information. When no user is logged in, they can still save data, unless you enforce Class Level Permissions.
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,
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.
The text was updated successfully, but these errors were encountered: