sghribi / loopback-fixtures

ISC License
18 stars 21 forks source link

I am getting the following error, cannot read the property IO of undefined #19

Open MROALI opened 7 years ago

MROALI commented 7 years ago

Hello below the error i am getting when trying to load fixtures using your component :

I am using fireloop, and loopback version 3.x. Thankyou in advance for your help.

node_modules/loopback-datasource-juggler/lib/observer.js:160 var retval = fn(context, next); ^ TypeError: Cannot read property 'IO' of undefined at ../fireloop/myproject/api/node_modules/@mean-expert/loopback-component-realtime/dist/mixins/fire-loop.js:40:25 at notifySingleObserver (/.../fireloop/lbdot/aktrade/api/node_modules/loopback-datasource-juggler/lib/observer.js:160:22) at ../fireloop/myproject/api/node_modules/loopback-datasource-juggler/node_modules/async/dist/async.js:3025:16 at replenish (../fireloop/myproject/api/node_modules/loopback-datasource-juggler/node_modules/async/dist/async.js:881:17) at ../fireloop/myproject/api/node_modules/loopback-datasource-juggler/node_modules/async/dist/async.js:885:9 at eachLimit$1 (../fireloop/myproject/api/node_modules/loopback-datasource-juggler/node_modules/async/dist/async.js:3114:22) at Object.<anonymous> (../fireloop/myproject/api/node_modules/loopback-datasource-juggler/node_modules/async/dist/async.js:917:16) at doNotify (../fireloop/myproject/api/node_modules/loopback-datasource-juggler/lib/observer.js:157:11) at doNotify (../fireloop/myproject/api/node_modules/loopback-datasource-juggler/lib/observer.js:155:49) at doNotify (../fireloop/myproject/api/node_modules/loopback-datasource-juggler/lib/observer.js:155:49) at doNotify (../fireloop/myproject/api/node_modules/loopback-datasource-juggler/lib/observer.js:155:49) at Function.ObserverMixin._notifyBaseObservers (../fireloop/myproject/api/node_modules/loopback-datasource-juggler/lib/observer.js:178:5) at Function.ObserverMixin.notifyObserversOf (../fireloop/myproject/api/node_modules/loopback-datasource-juggler/lib/observer.js:153:8) at Function.ObserverMixin._notifyBaseObservers (../fireloop/myproject/api/node_modules/loopback-datasource-juggler/lib/observer.js:176:15) at Function.ObserverMixin.notifyObserversOf (../fireloop/myproject/api/node_modules/loopback-datasource-juggler/lib/observer.js:153:8) at Function.ObserverMixin._notifyBaseObservers (../fireloop/myproject/api/node_modules/loopback-datasource-juggler/lib/observer.js:176:15)

The errors appears only when i execute load fixtures with the three mentionned method : autoload, app.loadFixtures() or from terminal.

Thnakyou in advance for your help.

aboglioli commented 6 years ago

Me too, if you find a solution please notify it.

MROALI commented 6 years ago

finaly i wrote my own boot script which reads data from a file and insert it in db. in your case try to call the script inside a boot script and your code to load fixutres inside
app.on('fire-connection-started', () => { app.loadFixtures() }

hope this will help

best regards