Unable to see mcrypt node module

Hi,

I have seen some of the postings related to this and followed the two options to install unsupported node module into Apigee Edge. But it seems like none of the issue is related to my problem.

I'm trying to install mcrypt module and it's not recognized although I have zip file in the node tree. Is there exception for certain modules?

Thanks in advance!

*** Error: Cannot find module './build/Release/mcrypt' Error: Cannot find module './build/Release/mcrypt' at module.js:340 at module.js:280 at module.js:364 at require (module.js:380) at /organization/environment/api/node_modules/mcrypt/index.js:3 at module.js:456 at module.js:474 at module.js:356 at module.js:312 at module.js:364 at require (module.js:380) at encrypt ... at module.js:312 at module.js:497 at startup (trireme.js:142) at trireme.js:923

Solved Solved
1 3 921
1 ACCEPTED SOLUTION

Not applicable

Hi @Mark Lee, I've just tried MCrypt on Edge, but unfortunately because it's based on native modules or code that requires compilation C libraries, it is not supported. For more information about non-native support, take a look at this http://docs.apigee.com/api-services/content/understanding-edge-support-nodejs-modules#restrictionso....

Alternatively, you can use other Crypto libraries like Crypto.js, I used it in the past with higher rate of success. Some of the cyphers are supported by Trireme. So you'll need to do some testing first on this. You can find more information about it here http://docs.apigee.com/api-services/content/understanding-edge-support-nodejs-modules#whichstandard....

View solution in original post

3 REPLIES 3

Hi @Mark Lee,

It's not clear which steps you are following, but there are a couple of ways you can import node dependencies into a proxy. As explained here, you can't install arbitrary node packages globally into Edge -- you have to install them for individual proxies.

You can use apigeetool to deploy an api proxy that already has a Node.js project in the apiproxy/resources/node directory. Let's say your node project includes node-modules/mcrypt. In this case you use the following. It's not necessary to zip anything.

apigeetool deployproxy -u <username> -o <org> -e <env> -n <proxy name>  --upload-modules

Another option is to install a node package into a proxy that's already deployed on Edge. You can do this with an Edge Management API. You must include whatever Node.js dependencies you require in your project's package.json file. Then, after you deploy your Node app to Edge, you can use this Management API to install the modules into the deployed project (basically, it runs 'npm install' in your project root on Edge). Be sure to specify 'command=install' in the API's request body.

I tried these steps in a test proxy and mcrypt did appear after deployment.

Does this help?

Will

@wwitman Thanks for your comment. yeah all the modules that I installed actually appeared in the node tree on the left hand side of the edge, but it still says Cannot find module when I start the session trace.

Not applicable

Hi @Mark Lee, I've just tried MCrypt on Edge, but unfortunately because it's based on native modules or code that requires compilation C libraries, it is not supported. For more information about non-native support, take a look at this http://docs.apigee.com/api-services/content/understanding-edge-support-nodejs-modules#restrictionso....

Alternatively, you can use other Crypto libraries like Crypto.js, I used it in the past with higher rate of success. Some of the cyphers are supported by Trireme. So you'll need to do some testing first on this. You can find more information about it here http://docs.apigee.com/api-services/content/understanding-edge-support-nodejs-modules#whichstandard....