Parse-server: Internal Server Error

Created on 25 Apr 2016  路  12Comments  路  Source: parse-community/parse-server

Since yesterday, we are having issues accessing particular feature in our app. We have query setup natively, but when that query is fired we get following error log on terminal

error: Uncaught internal server error. [TypeError: Cannot read property 'type' of undefined] TypeError: Cannot read property 'type' of undefined
    at /home/ubuntu/parse2/node_modules/parse-server/lib/Schema.js:750:38
    at Array.filter (native)
    at /home/ubuntu/parse2/node_modules/parse-server/lib/Schema.js:749:39
    at Schema.getRelationFields (/home/ubuntu/parse2/node_modules/parse-server/lib/Schema.js:760:10)
    at Object.untransformObject (/home/ubuntu/parse2/node_modules/parse-server/lib/Adapters/Storage/Mongo/MongoTransform.js:757:37)
    at DatabaseController.untransformObject (/home/ubuntu/parse2/node_modules/parse-server/lib/Controllers/DatabaseController.js:141:31)
    at /home/ubuntu/parse2/node_modules/parse-server/lib/Controllers/DatabaseController.js:773:25
    at Array.map (native)
    at /home/ubuntu/parse2/node_modules/parse-server/lib/Controllers/DatabaseController.js:772:29
    at run (/home/ubuntu/parse2/node_modules/parse-server/node_modules/babel-polyfill/node_modules/core-js/modules/es6.promise.js:89:22)

PFA screenshot as well.

screen shot 2016-04-25 at 4 31 18 pm

When I access this code, it shows error

PFQuery *query = [Group query];
[query whereKey:@"Member" equalTo:[PFUser currentUser]];
[query whereKey:@"RequestStatus" equalTo:@"Accepted"];
[query includeKey:@"GroupID"];
[query includeKey:@"GroupID.AdminID"];
[query includeKey:@"Member"];
[query findObjectsInBackgroundWithBlock:^(NSArray *objects, NSError *error) {

Any idea what's happening here? I'm using parse server version 2.2.7

Thanks

Most helpful comment

I'll Check it out

All 12 comments

I'll Check it out

thanks @flovilmart any luck? It's still showing the same error

UPDATE:

@flovilmart we downgraded parse server version to 2.2.6 and this error went away! There's really something wrong with v2.2.7. I hope in future releases we won't have this kind of problems. I'm closing this issue. Once we update to a new version I'll test this scenario once again and will open it if required. Thanks.

If this bug was introduced in 2.2.7 then it may exist in future versions until the cause can be tracked down and fixed.

As this is an open-source, community project there are some additional things you could do to help find the problem:

  • Could you explain more about the schema for Group and includes, and any ACL or CLP set on Group and the includes if relevant?
  • Could you run the failing query on your server with the server in verbose mode? (Set environment variable VERBOSE = true)
  • I recommend you also run the query as using the REST API to rule out any incompatibilities with client SDKs (seems like that is not the issue here however)
  • Would you be able to retest and remove the include GroupID.AdminID to see if the error persists?
  • You could also create a pull request with a test that exhibits this bug. This would be the most useful step to take and once fixed will ensure that the bug does not happen again.

I think it's worth reopening this bug as each bug fixed brings parse-server closer to completion.

Yes, let's please reopen this.

This code does it for me:

Parse.Cloud.define('test', function (req, res) { return res.success(); });

var User = Parse.User;
var Tribe = Parse.Object.extend('Tribe');
var user = new Parse.User({ username: 'username', password: 'password' });
user.signUp().then(function () {
  var tribe = new Tribe({ name: 'My Tribe' });
  return tribe.save();
}).then(function () {
  return Parse.Cloud.run('test');
}).then(function () {
  console.log('done');
});
verbose: GET /parse/classes/Tribe { 'user-agent': 'node-XMLHttpRequest, Parse/js1.8.3 (NodeJS 5.7.1)',
  accept: '*/*',
  'content-type': 'text/plain',
  host: 'localhost:7357',
  'content-length': '333',
  connection: 'close' } {
  "where": {
    "$relatedTo": {
      "object": {
        "__type": "Pointer",
        "className": "Tribe",
        "objectId": "ETyaJIwDJj"
      },
      "key": "users"
    }
  },
  "redirectClassNameForKey": "users"
}
verbose: error: TypeError: Cannot read property 'type' of undefined
    at /Users/Ian/Developer/wedo-parse-cloud-code/node_modules/parse-server/lib/Controllers/DatabaseController.js:109:10
    at run (/Users/Ian/Developer/wedo-parse-cloud-code/node_modules/babel-polyfill/node_modules/core-js/modules/es6.promise.js:89:22)
    at /Users/Ian/Developer/wedo-parse-cloud-code/node_modules/babel-polyfill/node_modules/core-js/modules/es6.promise.js:102:28
    at flush (/Users/Ian/Developer/wedo-parse-cloud-code/node_modules/babel-polyfill/node_modules/core-js/modules/_microtask.js:18:9)
    at _combinedTickCallback (node.js:370:9)
    at process._tickDomainCallback (node.js:425:11)

It's worth noting that I'm running into this in a test environment where there's no predefined schema.

Sure @steven-supersolid @peeinears I'm reopening this issue. I was waiting for next parse server release as MongoTransform.js & DatabaseController.js files have lots of changes when I compared 2.2.7 version and latest commit. We're working on releasing production build by this weekend, so unfortunately, I won't be able to provide logs and perform test cases. I'll try to get everything ready by Monday. Thanks.

Also experiencing this. Does anyone have a workaround or update? Running 2.2.10

Same problem here in 2.2.10 ;( Please help !
Back to 2.2.6 to get everything running back ...

I was experiencing the same issue, but realized that the key I was querying on didn't exist in my local development database. Once I added that key to the table the error went away.

Closing due to lack of activity, please update to latest parse-server version and reopen if the issue persist.

Don't forget to include your current:

  • node version
  • npm version
  • parse-server version
  • any relevant logs (VERBOSE=1 will enable verbose logging)

Thanks Flovilmart!
I changed it manually in my parse server code and the issue is fixed.

I had this error for iOS. I found a fix for myself:
I had originally created a column called Destination (which was of type String)
Then, I changed Destination (in my app) to type Destination (a pointer to my class Destination).
However, everytime I would try and save I would get the error:
TypeError: Cannot read property 'type' of undefined

I needed to manually go into my parse dashboard and delete the Destination (of type String) because it was still expecting a String. Then, when I ran my app again, it created a new column called Destination (of type pointer Destination). Then, everything was working well again.

In conclusion, try to make sure that you haven't created the same column name with the wrong type. I am not sure if this is a fix for everyone, but it fixed it for me.

Was this page helpful?
0 / 5 - 0 ratings