Manage "require" in custom plugins microgateway

Hi community,

On microgateway, I need to update extauth to accept RS512 algorithm.

I duplicated the extauth standard plugin to the edgemicro/plugins folder and renamed it extauth2.

I modified the contsant acceptAlg to accept RS512.

But when I start the microgateway, I get the following error :

rror: Cannot find module 'jsrsasign'

Any idea ?

Thanks

Bertrand

0 4 360
4 REPLIES 4

Did you try

Npm install

And install all dependencies



the plug-ins package.Json has that dependency https://github.com/apigee/microgateway-plugins/blob/master/extauth/package.json

Hi SatK,

No, it doesn't change, I still have the error.

Thanks for help

We are having the same issues with Cloud Foundry. We are trying to customize the extauth plugin to exclude validation of certain urls. The customized plugin(extauth2) is not able to import the jsrsasign module while deploying/pushing the Gateway to cloud foundry. 

2021-10-11T09:24:54.01-0400 [APP/PROC/WEB/0] OUT 2021-10-11T13:24:54.012Z info 2 installed plugin from accumulate-request
2021-10-11T09:24:54.01-0400 [APP/PROC/WEB/0] OUT 2021-10-11T13:24:54.012Z debug 2 installed plugin from accumulate-request and subconfig={}
2021-10-11T09:24:54.01-0400 [APP/PROC/WEB/0] OUT 2021-10-11T13:24:54.012Z info 2 installed plugin from healthcheck
2021-10-11T09:24:54.01-0400 [APP/PROC/WEB/0] OUT 2021-10-11T13:24:54.013Z debug 2 installed plugin from healthcheck and subconfig={}
2021-10-11T09:24:54.01-0400 [APP/PROC/WEB/0] OUT 2021-10-11T13:24:54.013Z info 2 installed plugin from cloud-foundry-route-service
2021-10-11T09:24:54.01-0400 [APP/PROC/WEB/0] OUT 2021-10-11T13:24:54.013Z debug 2 installed plugin from cloud-foundry-route-service and subconfig={}
2021-10-11T09:24:54.09-0400 [APP/PROC/WEB/0] ERR internal/modules/cjs/loader.js:905
2021-10-11T09:24:54.09-0400 [APP/PROC/WEB/0] ERR throw err;
2021-10-11T09:24:54.09-0400 [APP/PROC/WEB/0] ERR ^
2021-10-11T09:24:54.09-0400 [APP/PROC/WEB/0] ERR Error: Cannot find module 'jsrsasign'
2021-10-11T09:24:54.09-0400 [APP/PROC/WEB/0] ERR Require stack:
2021-10-11T09:24:54.09-0400 [APP/PROC/WEB/0] ERR - /home/vcap/app/plugins/extauth2/index.js
2021-10-11T09:24:54.09-0400 [APP/PROC/WEB/0] ERR - /home/vcap/app/lib/plugins.js
2021-10-11T09:24:54.09-0400 [APP/PROC/WEB/0] ERR - /home/vcap/app/lib/gateway.js
2021-10-11T09:24:54.09-0400 [APP/PROC/WEB/0] ERR - /home/vcap/app/lib/server.js
2021-10-11T09:24:54.09-0400 [APP/PROC/WEB/0] ERR - /home/vcap/app/lib/agent-config.js
2021-10-11T09:24:54.09-0400 [APP/PROC/WEB/0] ERR - /home/vcap/app/cli/lib/start-agent.js
2021-10-11T09:24:54.09-0400 [APP/PROC/WEB/0] ERR at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15).

 

Any resolutions?

Resolved this issue by adding  the dependency "jsrsasign""^8.0.20" in  global package.json