kibana-enhanced-table icon indicating copy to clipboard operation
kibana-enhanced-table copied to clipboard

Error when building plugin

Open abbanabennanih opened this issue 3 years ago • 7 comments

Hi,

I made some changes on the plugin and I'm facing the following error when trying to build the plugin for Kibana 7.10.2 version:

ERROR in /../elk/7.10.2/kibana/plugins/enhanced_table/kibana.json │ Bundle for [enhancedTable] lists [kibanaUtils, share, charts, visDefaultEditor] as a required bundle, but does not use it. Please remove it.

When I remove these bundles from kibana.json file, I'm able to build the plugin correctly. However, Kibana shows the following error as the bundles were excluded:

ERROR in ./public/data_load/kibana_cloned_code/courier.ts │ Module not found: Error: import [../../../../../src/plugins/kibana_utils/public] references a public export of the [kibanaUtils] bundle, but that bundle is not in the "requiredPlugins" or "requiredBundles" list in the plugin manifest [/../elk/7.10.2/kibana/plugins/enhanced_table/kibana.json] │ @ ./public/data_load/kibana_cloned_code/courier.ts 3:0-85 80:20-39 141:26-45 │ @ ./public/data_load/enhanced-table-request-handler.js │ @ ./public/enhanced-table-vis.js │ @ ./public/plugin.ts │ @ ./public/index.ts │ @ /Users/hamza/Desktop/work/elk/7.10.2/kibana/packages/kbn-optimizer/target/worker/entry_point_creator.js

Could you tell me how you were able to build your packages?

Regards

abbanabennanih avatar Feb 04 '21 20:02 abbanabennanih

Yes, I meet this annoying issue. This is how I do for now:

  • I use Kibana 7.9 for dev mode
  • I generate the plugin package with Kibana 7.9:
    • yarn compile
    • yarn build
  • When I build the plugin (yarn build), I specify 7.10.2 version
  • I install generated package on Kibana 7.10.2

fbaligand avatar Feb 04 '21 22:02 fbaligand

I was able to build my plugin package without errors by following your steps. However, when trying to install the plugin, I have this error:

Plugin installation was unsuccessful due to error "No kibana plugins found in archive"

Did you face the same error?

Also when I compare the content of your release (enhanced-table-1.11.0_7.10.2.zip) and what I packaged (my-enhanced-table.zip), these differences are noticed:

# diff enhanced-table-1.11.0_7.10.2.zip my-enhanced-table.zip

Only in kibana/my-enhanced-table/: server Only in tmp/kibana/enhanced-table/: target Only in kibana/my-enhanced-table/: translations Only in kibana/my-enhanced-table/: yarn.lock

abbanabennanih avatar Feb 06 '21 19:02 abbanabennanih

Finally I was able to build correctly my plugin with kibana 7.10.2. I made the following steps to do so:

  • Changed package.json by replacing/adding these 2 lignes:

    ...
    "build": "yarn plugin-helpers build",
    "plugin-helpers": "node ../../scripts/plugin_helpers",
    ...
    
  • Removed from kibana.json the following lines:

    ...
     "requiredBundles": [
           "kibanaUtils",
           "kibanaReact",
           "share",
           "charts"
    ]
    ...
    
  • executed yarn build

`

abbanabennanih avatar Feb 06 '21 21:02 abbanabennanih

Thanks for the share! very interesting to know. Happy to see it finally works.

that said, I’m surprised to see yarn plugin-helpers build. Do you have a global plugin-helpers module installed?

fbaligand avatar Feb 07 '21 07:02 fbaligand

No, it's a shorcut to ../../scripts/plugin_helpers. In other words, I have a line in my package.json as follow: "plugin-helpers": "node ../../scripts/plugin_helpers",

Just to complete the "solution" described in my previous post: the lines "requiredBundles": [ "kibanaUtils", "share", "charts", "visDefaultEditor" ] must be added in dev mode and removed before to lunch yarn build. Otherwise, Kibana will not start properly without these lines in dev mode.

abbanabennanih avatar Feb 07 '21 22:02 abbanabennanih

Oups, indeed. I misread your previous comment. Thanks again for sharing your feedback. If I have to do breaking changes with Kibana v7.11, I will create a branch and apply what you did.

fbaligand avatar Feb 09 '21 07:02 fbaligand

That said, the change you have to do in package.json between dev mode and build mode is quite sad. All configuration should be on git, and so, be the same, whatever your action.

I think that it would be nice to open an issue about that on Kibana's repository. Could you do this?

fbaligand avatar Feb 09 '21 07:02 fbaligand

Given that there is no feedback since more than one year, I close the issue.

fbaligand avatar Nov 11 '22 15:11 fbaligand