Graylog Plugin / Webpack issues


(Bradley Kite) #1

Hi,

Very similar to Graylog plugin UI not coming up in production server - my plugin works in development mode (“npm run start”) but does not work when deployed in production.

In the UI, the browser fetches /assets/plugin/org.graylog.plugins.reports.plugins.reports.ReportsPlugin/plugin.org.graylog.plugins.reports.ReportsPlugin.11e7b7eea0147f11127f.js - which in turn tries to add a new script element for /assets/1.1.11e7b7eea0147f11127f.js - but this returns a 404, because the asset is not part of the main server, it is part of the plugin - so its path should be under /assets/plugin/…

Also, having a look at the “build” directory and comparing it with other plugins, it looks like webpack is not generating the right output:

                                               Asset       Size  Chunks             Chunk Names
                     1.1.1932fafd00279821fbb8.js.map    4.47 MB       1  [emitted]  
                31a71554a7917f4d60fb34b775a158da.jpg     261 kB          [emitted]  
                         1.1.1932fafd00279821fbb8.js    3.76 MB       1  [emitted]  
                         2.2.1932fafd00279821fbb8.js    3.68 MB       2  [emitted]  
                         3.3.1932fafd00279821fbb8.js    3.68 MB       3  [emitted]  
plugin.org.graylog.plugins.reports.ReportsPlugin.1932fafd00279821fbb8.js     114 kB       4  [emitted]  
plugin.org.graylog.plugins.reports.ReportsPlugin
                         5.5.1932fafd00279821fbb8.js    15.1 kB       5  [emitted]  
                         6.6.1932fafd00279821fbb8.js      25 kB       6  [emitted]  
                         7.7.1932fafd00279821fbb8.js    8.15 kB       7  [emitted]  
                         8.8.1932fafd00279821fbb8.js    2.11 kB       8  [emitted]  
                     0.0.1932fafd00279821fbb8.js.map    4.47 MB       0  [emitted]  
                         0.0.1932fafd00279821fbb8.js    3.76 MB       0  [emitted]  
                     2.2.1932fafd00279821fbb8.js.map    4.38 MB       2  [emitted]  
                     3.3.1932fafd00279821fbb8.js.map    4.38 MB       3  [emitted]  
plugin.org.graylog.plugins.reports.ReportsPlugin.1932fafd00279821fbb8.js.map     135 kB       4  [emitted]  
plugin.org.graylog.plugins.reports.ReportsPlugin
                     5.5.1932fafd00279821fbb8.js.map    14.3 kB       5  [emitted]  
                     6.6.1932fafd00279821fbb8.js.map    25.8 kB       6  [emitted]  
                     7.7.1932fafd00279821fbb8.js.map    11.3 kB       7  [emitted]  
                     8.8.1932fafd00279821fbb8.js.map    2.29 kB       8  [emitted]  
                                         favicon.png  701 bytes          [emitted]  
                                          index.html  380 bytes          [emitted]  
                                         module.json  279 bytes          [emitted]  
plugin.org.graylog.plugins.reports.ReportsPlugin.module.json  279 bytes          [emitted]  

When comparing this to other plugins, each .js file is prefixed with the plugin name, eg: plugin.org.graylog.plugins.aggregates.AggregatesPlugin.13cee0813b7a098ad242.js

This is my webpack.config.js:

const PluginWebpackConfig = require('graylog-web-plugin').PluginWebpackConfig;
const loadBuildConfig = require('graylog-web-plugin').loadBuildConfig;
const path = require('path');

module.exports = new PluginWebpackConfig('org.graylog.plugins.reports.ReportsPlugin', loadBuildConfig(path.resolve(__dirname, './build.config')), {
  // Here goes your additional webpack configuration.
});

and this is my build.config.js:

const path = require('path');

module.exports = {
  web_src_path: path.resolve(__dirname, '../graylog2-server/graylog2-web-interface'),
};

Also, I noticed the entry point to other plugins does NOT create an additional script tag, whereas my plugin’s entry point generated by webpack does.

Is there anything else I can check?


(system) #2

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