TypeError: Cannot read property 'properties' of undefined

耗尽温柔 提交于 2019-12-12 00:57:12

问题


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:

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:


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



来源:https://stackoverflow.com/questions/15393621/typeerror-cannot-read-property-properties-of-undefined

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!