I’m new to Graylog Development and still trying to figure out the code-base and how everything ties together, but I’m struggling with getting a plugin to work while running in development mode with IntelliJ.
I have the server running in IntelliJ, and I also have the npm development web server running so I can make live-changes.
However, I’m not sure how the plugin needs to integrate with the NPM webserver. Does it need to install files into the graylog2-server/graylog2-web-interface directory?
When I browse to the webserver, under System => Configurations, I can see some information about the newly added threat-intel plugin, but when I click on the “Configure” button, the browser throws a javascript exception:
vendor.js:39306 Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. Check the render method of ThreatIntelPluginConfig.
at invariant (vendor.js:39306)
at instantiateReactComponent (vendor.js:10840)
at instantiateChild (vendor.js:31297)
at traverseAllChildrenImpl (vendor.js:11154)
How can I tell that the browser is able to load the required code in order to render this plugin’s GUI?
After some further research, I’ve discovered that the main webpack (in graylog2-server/graylog2-web-interface/webpack.combined.config.js) is responsible for loading in the GUI code of any plugins by looking for plugins in …/…/graylog-plugin-*/**/webpack.config.js, and I can actually see it being loaded when I run “npm start”:
So can anyone explain why I’m getting the above Javascript exception?
vendor.js:39306 Uncaught Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. Check the render method of ThreatIntelPluginConfig.
at invariant (vendor.js:39306)
at instantiateReactComponent (vendor.js:10840)
at instantiateChild (vendor.js:31297)
at traverseAllChildrenImpl (vendor.js:11154)
I’ve made no changes as yet - I’m just trying to get to grips with everything before I start on any changes.
I do, however, get these types of errors when starting npm:
ERROR in /home/bradley/git/graylog-project-repos/graylog-plugin-pipeline-processor/plugin/src/web/pipelines/PipelineForm.jsx
Module not found: Error: Can't resolve 'react-bootstrap' in '/home/bradley/git/graylog-project-repos/graylog-plugin-pipeline-processor/plugin/src/web/pipelines'
@ /home/bradley/git/graylog-project-repos/graylog-plugin-pipeline-processor/plugin/src/web/pipelines/PipelineForm.jsx 11:22-48
@ /home/bradley/git/graylog-project-repos/graylog-plugin-pipeline-processor/plugin/src/web/pipelines/PipelineDetails.jsx
@ /home/bradley/git/graylog-project-repos/graylog-plugin-pipeline-processor/plugin/src/web/pipelines/Pipeline.jsx
@ /home/bradley/git/graylog-project-repos/graylog-plugin-pipeline-processor/plugin/src/web/pipelines/PipelineDetailsPage.jsx
@ /home/bradley/git/graylog-project-repos/graylog-plugin-pipeline-processor/plugin/src/web/index.jsx
@ multi (webpack)-dev-server/client?http://0.0.0.0:8081 webpack/hot/dev-server /home/bradley/git/graylog-project-repos/graylog-plugin-pipeline-processor/plugin/src/web
They dont seem to be relevant tho, as everything else in the GUI seems to work just fine - the only thing I’m having a problem with is the “Configure” button for the ThreatIntel plugin.
I dont think this is a capitlisation / CamelCase issue. The code which defines the render class looks like this:
After checking out 2.2 instead of master, then this plugin seems to be working just fine so I’ll develop from the 2.2 branch, as master seems to be in a state of flux at the moment.