Web services plugins error 12.1


I just upgraded to the new 12.1 version. Everything works great except my web services in the “plugins” folder.

I keep getting errors that I didn’t get before. I migrated back to 12.0.3 and everything works fine.


Hello James,
what errors are you getting?

Hi Fabio,

log [12:30:59.662] [warning][config][deprecation] investigate_core.load_jdbc is deprecated and is no longer used
log [12:31:00.592] [fatal] TypeError: require(…) is not a function
at Plugins.new (/opt/siren-investigate/src/server/plugins/plugin_collection.js:65:43)
at KbnServer.module.exports (/opt/siren-investigate/src/server/plugins/scan.js:68:22)
at KbnServer.mixin (/opt/siren-investigate/src/server/kbn_server.js:99:7)
at Command. (/opt/siren-investigate/src/cli/serve/serve.js:153:7)
FATAL TypeError: require(…) is not a function
at Plugins.new (/opt/siren-investigate/src/server/plugins/plugin_collection.js:65:43)
at KbnServer.module.exports (/opt/siren-investigate/src/server/plugins/scan.js:68:22)
at KbnServer.mixin (/opt/siren-investigate/src/server/kbn_server.js:99:7)
at Command. (/opt/siren-investigate/src/cli/serve/serve.js:153:7)

It’s the same error across all web scrips. I even used the default one (weather) and it does the same thing.

I double checked the code. Seems fine and works when invoked… Any ideas?

The issue is likely caused by this line in the index file of the plugin:

module.exports = web_service_interface_1.registerServices('group', [ServiceName.default])

Removing .default would likely fix the issue, however this type of import should be handled out of the box, so there must be an issue preventing the recognition, we are currently investigating.

Ae you running Investigate on Docker or on a plain machine?

My index file looks like this:
“use strict”;
import { registerServices } from ‘@sirensolutions/web-service-interface’;
import { MyWeatherService } from ‘./src/MyWeatherService’;
export default registerServices(‘weather’, [MyWeatherService]);

Running on a plain VM

Inside the src folder it looks like this:

“use strict”
import { ServiceDefinition, WebServiceError } from ‘@sirensolutions/web-service-interface’;
import axios from ‘axios’;

export class MyWeatherService extends ServiceDefinition {
name = ‘weatherservice’;
inputSchema = {
city_name: {
type: ‘text’,
description: ‘name of the city to get weather information for’,
required: true
outputConfiguration = {
weather: {
name: ‘keyword’,
main: ‘text’,
location: ‘geo_point’,
temperature: ‘long’
// Called to invoke the service. The inputs argument will have fields described in this.inputSchema
async invoke(inputs) {
// The API endpoint to send a query to
const url = 'https://api.openweathermap.org/data/2.5/weather?’;

// Parameters are added to the end of a URL:
// E.g.  https://api.openweathermap.org/data/2.5/weather?q=London&appid=<your-api-key>
const params = {
  q: inputs.city_name,
  appid: 'API' 
const headers = {
  'Content-Type': 'application/json'

// The axios library is used here, but you can use a different library/implementation for querying an API
const response = await axios.get(url, { params, headers })
  .catch(error => Promise.reject(error.response && error.response.status < 500 ? new WebServiceError(error.response.data) : error)); 

// Must return objects with the same structure as in this.outputConfiguration. These are stored in Elasticsearch automatically.
return {
  weather: [{
    name: response.data.name,
    main: response.data.weather[0].main,
    location: response.data.coord,
    temperature: response.data.main.temp


Standing by. Thanks Fabio!

Thanks for the info, this looks like an issue with the transpiler when processing plugins that were not produced by the generator tool, will get back to you if there’s a workaround, otherwise we’ll put a fix in 12.1.1 .

Thanks! Really hope you can find a workaround. Can’t have it not working…


I found a way around it. Just added it to the default section in siren_web_services. Works like a charm. Thanks!

Hi James,
another workaround would be to replace src/server/plugins/plugin_collection.js with the full contents of the gist below, then the plugins should run unchanged.

1 Like