TypeError: Cannot read property 'properties

2019-08-16 09:30发布

I have a Node.js/Geddy app which was working untill a few minutes ago. Now, when I try to run it, I get the following error:

http://s7.postimage.org/ywqr0mod7/console.png

I have many models, but for one of them, I get this error.

The error is shown because in the file whose path is displayed in the console the following is undefined:

reg[ownedModelName]

where

reg = model.descriptionRegistry

and ownedModelName is given by

if (assnKey == 'belongsTo') {
        ownerModelName = modelName;
        ownedModelName = self.name;
        idKey = modelName;
      }
      else {
        ownerModelName = self.name;
        ownedModelName = modelName;
        idKey = self.name;
      }

Actually, I know the value of ownedModelName, but I don't know why reg[ownedModelName] is undefined.

This is how the model which triggers the error looks like:

var RenderingForm = function () {

 this.defineProperties({
    name: {type: 'string'},
    description: {type: 'string'},
    mode: {type: 'string'},
    helpText: {type: 'string'},
    noEvaluation: {type: 'boolean'},
    compatibleProblemTypes: {type: 'string'}
  });

  this.validatesPresent('name');
  this.validatesPresent('description');


};

RenderingForm = geddy.model.register('RenderingForm', RenderingForm);

Why is that undefined and how can I solve my problem?

UPDATE:

I've tried to create the same app on another partition, it didn't work, and now when I've tried again to run the old app, I get the same error, but for another model than before.

1条回答
We Are One
2楼-- · 2019-08-16 10:10

Finally!!! Thanks to THIS I've found out that it was a hasOne() or has Many() with a wrong parameter.

查看更多
登录 后发表回答