Getting Module not found error after installing plugin

Hi Team,

I am working on 7.10.0 kibana. I have created a custom plugin and after deploying it was getting ssl certificate error. To solve that i had installed "ssl-root-cas" using this package I am adding required certificate and create httpsAgent and use it in my apis as shown below.

  var rootCas = require('ssl-root-cas').create();

  rootCas.addFile(certificatepath);

  require('https').globalAgent.options.ca = rootCas;

  const https = require('https');
  const http = require('http');
  const httpsAgent = useHttps ? new https.Agent({
    rejectUnauthorized: true,
    ca: rootCas
  }) : new http.Agent({});

When I test the app locally it works fine, but after creating build and installing the plugin, it gives error - "Error: Cannot find module 'ssl-root-cas'"

below is my package.json file.

{
  "name": "correlationapp",
  "version": "7.10.0",
  "private": true,
  "scripts": {
    "build": "yarn plugin-helpers build",
    "plugin-helpers": "node ../../scripts/plugin_helpers",
    "kbn": "node ../../scripts/kbn"
  },
  "dependencies": {
    "moment": "^2.24.0",
    "ssl-root-cas": "^1.3.1"
  }
}

Regards
Praveer.

Good afternoon, Praveer!

First, can you confirm the package you're referencing is in the node-modules folder of your plugin?

Second, can you confirm you're using the latest process for building your plugin:

Hi @clintandrewhall,

Yes the package is present in node-modules

I went through the link you had shared to create the build & yes i have followed the same methods.

Regards
Praveer.

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