senecajs / seneca-jsonfile-store

Node.js Seneca data storage module that uses JSON files.
MIT License
13 stars 11 forks source link

Plugin failing after seneca/ seneca-entity upgrade #34

Open uover822 opened 1 year ago

uover822 commented 1 year ago

Hi, After applying some seneca upgrades, as:

@seneca/user ^6.2.0 → ^6.3.0 seneca 3.30.1 → 3.31.1 seneca-entity 22.1.0 → 23.0.0 seneca-promisify ^3.4.0 → ^3.5.0

I'm getting the following errors:

{"kind":"fatal","level":600,"plugin":"seneca","tag":"3.31.1","id":"ltdtbxudl0rb/1688045676421/36470/3.31.1/store","code":"plugin_define_failed","notice":"seneca: The definition action for the plugin jsonfile-store has failed: Cannot read properties of undefined (reading 'init') (jsonfile-store.js:324:32). This error is considered fatal as all plugins have to initialize correctly. You should test the plugin by itself to verify that it is working correctly. Also ensure that the configuration options passed to the plugin are correct. These are shown below under in the DETAILS section. There could also be a bug in the plugin. If you think that is the case, please create a github issue on the plugin's repository, and include this error report.","err":{"eraro":true,"orig":{},"code":"plugin_define_failed","seneca":true,"package":"seneca","msg":"seneca: The definition action for the plugin jsonfile-store has failed: Cannot read properties of undefined (reading 'init') (jsonfile-store.js:324:32). This error is considered fatal as all plugins have to initialize correctly. You should test the plugin by itself to verify that it is working correctly. Also ensure that the configuration options passed to the plugin are correct. These are shown below under in the DETAILS section. There could also be a bug in the plugin. If you think that is the case, please create a github issue on the plugin's repository, and include this error report.","details":{"fullname":"jsonfile-store","message":"Cannot read properties of undefined (reading 'init') (jsonfile-store.js:324:32)","options":{"folder":"/opt/msr/data"},"repo":"","errmsg":"Cannot read properties of undefined (reading 'init')","errline":"at jsonfile-store (/opt/msr/store/node_modules/seneca-jsonfile-store/jsonfile-store.js:324:32)","orig$":{},"message$":"Cannot read properties of undefined (reading 'init')"},"callpoint":"at jsonfile-store (/opt/msr/store/node_modules/seneca-jsonfile-store/jsonfile-store.js:324:32)","plugin":"jsonfile-store","plugin_callpoint":"at Object. (/opt/msr/store/srv/store-dev.js:6:4)","fatal$":true},"isot":"2023-06-29T13:34:37.072Z","when":1688045677072,"level_name":"fatal","seneca_id":"ltdtbxudl0rb/1688045676421/36470/3.31.1/store"}

The related source file/ line looks like:

var storedesc = seneca.store.init(seneca, options, store)

{"kind":"fatal","level":600,"plugin":"seneca","tag":"3.31.1","id":"d150rqc1257t/1688045677492/36471/3.31.1/web","code":"plugin_define_failed","notice":"seneca: The definition action for the plugin jsonfile-store has failed: Cannot read properties of undefined (reading 'init') (jsonfile-store.js:304:32). This error is considered fatal as all plugins have to initialize correctly. You should test the plugin by itself to verify that it is working correctly. Also ensure that the configuration options passed to the plugin are correct. These are shown below under in the DETAILS section. There could also be a bug in the plugin. If you think that is the case, please create a github issue on the plugin's repository, and include this error report.","err":{"eraro":true,"orig":{},"code":"plugin_define_failed","seneca":true,"package":"seneca","msg":"seneca: The definition action for the plugin jsonfile-store has failed: Cannot read properties of undefined (reading 'init') (jsonfile-store.js:304:32). This error is considered fatal as all plugins have to initialize correctly. You should test the plugin by itself to verify that it is working correctly. Also ensure that the configuration options passed to the plugin are correct. These are shown below under in the DETAILS section. There could also be a bug in the plugin. If you think that is the case, please create a github issue on the plugin's repository, and include this error report.","details":{"fullname":"jsonfile-store","message":"Cannot read properties of undefined (reading 'init') (jsonfile-store.js:304:32)","options":{"folder":"/opt/msr/data"},"repo":"","errmsg":"Cannot read properties of undefined (reading 'init')","errline":"at jsonfile-store (/opt/msr/web/node_modules/seneca-jsonfile-store/jsonfile-store.js:304:32)","orig$":{},"message$":"Cannot read properties of undefined (reading 'init')"},"callpoint":"at jsonfile-store (/opt/msr/web/node_modules/seneca-jsonfile-store/jsonfile-store.js:304:32)","plugin":"jsonfile-store","plugin_callpoint":"at Object. (/opt/msr/web/srv/web-dev.js:8:4)","fatal$":true},"isot":"2023-06-29T13:34:37.705Z","when":1688045677705,"level_name":"fatal","seneca_id":"d150rqc1257t/1688045677492/36471/3.31.1/web"}

The related source file/ line looks like:

if (good(args, err, cb)) {

Are there new properties/ options to be added?

Are there others seeing? Please let me know of any updates/ ideas.

Thanks

uover822 commented 1 year ago

May relate to https://github.com/senecajs/seneca-store-test/issues/47, as similar issue.

uover822 commented 1 year ago

Hi :-) Fwiw, it appears this issue can remediated by adding/ updating the following lines in jsonfile-store.js

let init = seneca.export('entity/init') // ln ~33 var storedesc = init(seneca, options, store) // ln ~305