Skip to content

afterSave triggered for 'ClassName' for user undefined: #3353

@newdev7

Description

@newdev7

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

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