Closed xbill82 closed 8 years ago
The problems seems to happen at the compareVersions
call at lib/api/core/plugins/packages/pluginPackage.js:140
After inspecting the arguments passed to compareVersions
(via console.log
LOL) I realized that, in certain cases, the config.version
(i.e. the one fetched from the DB) is undefined
.
Not sure why this happens (I assume that my plugin had been installed before restarting Kuzzle), but adding an extra if
solves the problem.
Wait, but... The version
field for the plugin is actually never written in the persisted configuration. Going to investigate this.
Ok, seems that the PluginPackage
is unable to detect the installed version based on the output of npm install
.
The regexp at https://github.com/kuzzleio/kuzzle/blob/501-startup-crash-after-plugin-install/lib/api/core/plugins/packages/pluginPackage.js#L199 does not match the standard output of npm
kuzzle-plugin-auth-passport-oauth@2.0.3 node_modules/kuzzle-plugin-auth-passport-oauth
├── passport-oauth2-refresh@1.0.0
└── passport-oauth2@1.3.0 (uid2@0.0.3, oauth@0.9.14)
So the version number is never found.
Ok, so #503 now fixes the version detection on npm install. But now I wonder if it's a good idea to install the plugin if the version is not found in the definition fetched from the DB.
Steps to reproduce:
kuzzle-plugin-auth-passport-oauth
plugin via the CLIpassport-google-oauth
package via npm in your Kuzzle instanceReceiving many errors like