Skip to content

Version 2.2.24 and above breaks fetch() method - undefined, unauthorized #3051

Closed
@MartinHerman

Description

@MartinHerman

Hi everyone,
I've discovered an error with v2.2.24 and above with the fetch() method. The same exact code worked with v2.2.23 and below - I've tested numerous lower versions and all worked. Parse SDK JS is v1.9.2 and changing to lower versions doesn't affect the error.

Here is my code:

Parse.Cloud.define("pretty_function", function(req, res){

    var MyClass = Parse.Object.extend("MyClass");
    var myObject = MyClass.createWithoutData(req.params.valid_object_id);

    myObject.fetch().then(function(obj){

      res.success(obj);

    }, function(error){

      res.error(error);
      
    });

});

Error log

2016-11-14T15:29:55.906447+00:00 app[web.1]: error: Failed running cloud function pretty_function for user Nhb05Y36Sc with:
2016-11-14T15:29:55.906458+00:00 app[web.1]:   Input: {"valid_object_id":"6gA8W9ivhe"}
2016-11-14T15:29:55.906462+00:00 app[web.1]:   Error: {"code":141,"message":{"message":"unauthorized"}} functionName=pretty_function, code=141, code=undefined, message=unauthorized, valid_object_id=6gA8W9ivhe, user=Nhb05Y36Sc
2016-11-14T15:29:56.089761+00:00 app[web.1]: error: Error generating response. ParseError {
2016-11-14T15:29:56.089765+00:00 app[web.1]:   code: 141,
2016-11-14T15:29:56.089767+00:00 app[web.1]:   message: ParseError { code: undefined, message: 'unauthorized' } } code=141, code=undefined, message=unauthorized
2016-11-14T15:29:56.118083+00:00 app[web.1]: [object Object]

I'm calling it from the Parse iOS SDK 1.14.2, with an authenticated user (other authenticated calls work fine). The permissions for the object I'm trying to fetch() are Public Read, Administrator (Role) Read/Write.

As I've said, the only thing I changed is the Parse-Server version, else than that everything stayed the same.

I've compared 2.2.23 and 2.2.24, and I'd guess the error will be somewhere in the spec/Middlewares.spec.js changes, however I can't figure it out.

I'm guessing this error appears elsewhere as well, therefore I'd consider this a critical error.

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