My plugin will build and install, but kibana wont run

I'm developing a plugin with Kibana v7.5.1, and I have it in a state where I want to build the plugin and install it into a docker container, and recommit the container and save it to my private registry.
All of these steps works just fine

yarn kbn bootstrap
yarn start  # for development
yarn build

builds just fine, then trying to install and run, the following steps are actually in a Dockerfile, but behave the same done this way.

docker run --rm -it --name kb docker.elastic.co/kibana/kibana:7.5.1 bash

In another shell:

docker cp /path/to/built/plugin.zip kb:/plugin.zip

back in kibana container

bin/kibana-plugin install file:///plugin.zip
... # installs just fine
bin/kibana

the bin/kibana command will give me the following output:
FATAL Error: Cannot find module '/usr/share/kibana/plugins/myPlugin'

plugins/myPlugin exists, and has my code in it. Why cant it be found?

Hi, it looks to me like you're using the right steps to make this Docker image.

  • Have you tried running your plugin in "dist" mode before this? Instead of yarn start give this a try: node scripts/kibana --config=config/kibana.dev.yml and see if Kibana can run with your plugin in non-dev mode.

  • Can you include more of the error message? I want to see if there is a stack trace that is pointing to the problem

So when I run the container, the follow log gets dumped:

Error: Cannot find module '/usr/share/kibana/plugins/cadence'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at createPack (/usr/share/kibana/src/legacy/plugin_discovery/plugin_pack/create_pack.js:33:18)
at MapSubscriber.packageJson$.pipe [as project] (/usr/share/kibana/src/legacy/plugin_discovery/plugin_pack/create_pack.js:66:11)
at MapSubscriber._next (/usr/share/kibana/node_modules/rxjs/internal/operators/map.js:46:35)
at MapSubscriber.Subscriber.next (/usr/share/kibana/node_modules/rxjs/internal/Subscriber.js:64:18)
at RefCountSubscriber.Subscriber._next (/usr/share/kibana/node_modules/rxjs/internal/Subscriber.js:87:26)
at RefCountSubscriber.Subscriber.next (/usr/share/kibana/node_modules/rxjs/internal/Subscriber.js:64:18)
at Subject.next (/usr/share/kibana/node_modules/rxjs/internal/Subject.js:57:25)
at ConnectableSubscriber.Subscriber._next (/usr/share/kibana/node_modules/rxjs/internal/Subscriber.js:87:26)
at ConnectableSubscriber.Subscriber.next (/usr/share/kibana/node_modules/rxjs/internal/Subscriber.js:64:18)
at DistinctSubscriber._finalizeNext (/usr/share/kibana/node_modules/rxjs/internal/operators/distinct.js:70:30)
at DistinctSubscriber._useKeySelector (/usr/share/kibana/node_modules/rxjs/internal/operators/distinct.js:64:14)
at DistinctSubscriber._next (/usr/share/kibana/node_modules/rxjs/internal/operators/distinct.js:48:18) code: 'MODULE_NOT_FOUND'

Followed by a couple lines saying its stopping other (builtin) plugins, then by:

 FATAL  Error: Cannot find module '/usr/share/kibana/plugins/cadence'

For running the node scripts/kibana --config path/to/config, Everything starts fine. Browsing to my.kibana.url.com/status shows my plugin is GREEN

I'm sorry but I'm really not sure what's going wrong. It's hard to say without access to the code.

Just a wild guess, but there is an index.js file in this path, correct? One thing to check is that Typescript conversion is happening properly, if that's applicable.

Actually, yeah. Thanks for pointing that out. I am using typescript everywhere, including the index.ts. When I unpack the .zip, there is no index.js next to the node_modules.

All other files in the server code is correctly compiled down from typescript to js.

I just checked, and if I change index.ts to index.js, index.js will now be in the package after I build it.

After installing, it looks like Kibana will run, but I do not see my plugin at the moment. I'll continue investigating later today.

So changing index.ts to index.js has the plugin working now. This looks like a bug, and I'll make an issue on the kibana repo.

I'm glad to hear we figured it out! Thanks for filing the bug for tracking

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.