holidayextras / jsonapi-store-relationaldb

A relational database handler for jsonapi-server
MIT License
33 stars 32 forks source link

TypeError: Cannot convert undefined or null to object at SqlStore._buildModels #52

Open csprocket777 opened 7 years ago

csprocket777 commented 7 years ago

I am using the handler code from the example in the readme and am running into the error below when I run node.

Any ideas on how I can solve this?

/Users/[path to app]/node_modules/jsonapi-store-relationaldb/lib/sqlHandler.js:104
  var localAttributes = Object.keys(self.resourceConfig.attributes).filter(function(attributeName) {
                               ^

TypeError: Cannot convert undefined or null to object
    at SqlStore._buildModels (/Users/[path to app]/node_modules/jsonapi-store-relationaldb/lib/sqlHandler.js:104:32)
    at SqlStore.initialise (/Users/[path to app]/node_modules/jsonapi-store-relationaldb/lib/sqlHandler.js:72:8)
    at Object.jsonApi.define.resourceConfig [as define] (/Users/[path to app]/node_modules/jsonapi-server/lib/jsonApi.js:68:29)
    at Object.<anonymous> (/Users/[path to app]/index.js:29:9)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Module.runMain (module.js:575:10)
    at run (bootstrap_node.js:352:7)
    at startup (bootstrap_node.js:144:9)
    at bootstrap_node.js:467:3
paparomeo commented 7 years ago

Hi @csprocket777. I'll try to reproduce and will get back to you.