[7.2] Kibana plugin development possible bug

Ok I guess I found the problem with the help of a colleague of mine.

Reading the error there's a call to kbn-plugin-helpers/tasks/start/start_action.js.

Going back through all the linked files we noticed there's a line in packages/kbn-plugin-helpers/lib/plugin_config.js which refers to the old folder structure, calling the path ../../kibana as if the plugin was placed inside the old kibana-extra folder.

The error

`Error: The 'KIBANA_ROOT' environment variable has been removed from '@kbn/plugin- helpers'. During development your plugin must be located in '../kibana-extra/{pluginName}' relative to the Kibana directory to work with this package.`

should have rung a bell about it.

Then we went with git blame packages/kbn-plugin-helpers/lib/plugin_config.js from which you can see that Tiago Costa applied a fix to that path in commit e4830625.

Thus, running git show e4830625 | git apply from v7.2.0 branch, you can see that some files got modified

It'll then be sufficient to add the edits (git add .) and commit ignoring the linter (git commit -m "whatever" --no-verify).

Now, running the yarn kbn bootstrap, node scripts/generate_plugin.js my_plugin and cd plugins/my_plugin/, yarn start everything works as expected.

It's kinda strange that such an important fix is not mentioned anywhere (apart from git history) and I really do not understand how it could work on your environment.
You sure replicated my exact steps, cloning the repo, checking out to 7.2.0 and running everything else without changing anything? Since it really shouldn't work because of that wrong path.

Anyway, hope this thread will be of help to anybody who needs to develop a plugin for Kibana 7.2.x.

2 Likes