Unable to make uploaded Node.js code work in Apigee Edge that works otherwise locally

Not applicable

Hello

I have a Node.js project that uses nools npm package (a RETE based rules engine). On my local setup, the project works fine and the rules fire as expected when the API is invoked locally but when I used the apigeetool to deploy this project in Apigee Edge, I got some misleading errors by apigeetool which eassentially made me replace keyword "let" with "var" in my .js files. After which the deploy succeeded but when I invoke the deployed API, I get an error in the logs, essentially meaning that some object is undefined in the rule object. It seems Apigee Edge is unable to handle some javascript constructs that might be in nools package..

TypeError: Cannot read property "length" from undefined at /organization/environment/api/node_modules/nools/lib/rule.js:240

Any Thoughts?

0 3 232
3 REPLIES 3

hari_vr
Participant IV

You have not specified whether you were using an OPDK or the cloud instance of Apigee. Read on if you are using the OPDK.

I had faced a somewhat similar issue with NodeJS in our OPDK Apigee. The issue turned out to be that the trireme version in our Apigee installation (v15.07) was a slightly older version which could not run some commands from Express and other modules.

So perhaps its merely a version incompatibility?

I am using Apigee Cloud and express as the web framework in my node project. I do realize this is some version incompatibility - the trireme version in cloud is not able to handle something. is there any workarounds?

@Greg Brail Any thoughts on this ?