ScriptEngine for node not found Error in Test environment

Not applicable

Hi, I'm trying to configure node js into my proxy and getting the following error in deployment.

The below hellp sample app is working fine in my org. Not sure do I need to install anything in my org for node js configurations?

https://github.com/apigee/node-samples/tree/master/apigee/hello

Please help me to resolve this. Thanks!

Error Deploying Revision 1 to test ScriptEngine for node not found. Context Revision:1;APIProxy:785-sampleweatherapi-1;Organization:swapnaadusu07;Environment:test.

0 15 426
15 REPLIES 15

That is not an usual error. Along with the other errors which you have reported before I wonder if somehow messed up. Can you try to deploy in a different org and see if you still get the same error ?

Can you try to create the node app using the proxy creation wizard which creates a sample node script for you. If that works then we will know that the org is not corrupted.

@sarthakI have created a node js app thru proxy creation wizard and it's working fine. I have created a same folder structure but still it's giving the same error. I have uploaded my proxy. Please go through it and let me know if you see any issue. Thanks!

Thanks @sarthakBasically, I have a requirement to add a node js functionality into the existing proxies into production to send email notifications. You remembered the other day I had worked on Python for the same. But now we are going to use the node js. For that one, If I'm creating a folder resources/node/*.js file. But it's alwaying giving error for my sample prox

You are calling a node script from a python policy . That is not how it works

Please read the documentation here : http://apigee.com/docs/api-services/content/getting-started-nodejs-apigee-edge and see the structure of the sample proxy. You will be able to see the difference.

Node is not a policy , it acts as a target.

Let us know if you need any further clarification.

Not applicable

Thanks @sarthak. I got it now. I did the changes but it's giving different deployment error. Any idea what was it? For your reference attached the proxy.

Error in deployment for environment test. The revision is deployed and traffic can flow, but flow may be impaired. Call timed out

Not applicable
@sarthak Not sure now it is working. I believe, there is a problem in the open session of Edge. The changes are not reflecting immediately. Suppose I have deployed the new version of any proxy still it looks like it was taking the previous version code instead of new version code. That's why the above example didn't worked fine yesterday and it should work fine in the new session. I just wanted to let you know.

So, we can't call node js script in the <FaultRules/> as it's not a policy and it works as a target. Please confirm.

Well .. that is strange. It can happen though that the previous revision was deployed and though the new revision was created it was never deployed or in Apigee term it was inactive.

Yes to your statement around node. It is a target and not a policy. You cannot treat it as any other policy.

@sarthak Thanks!

Can I call this target in the FaultRules in TargetEndpoint post-flow? I didn't find any tag like ResourceURL to configure this in FaultRules. Please confirm.

Node acts as Target. You can ONLY configure it to be target. You cannot invoke it in ANY other way.

You can create a separate proxy (Proxy 1) which has the node code to send emails and then the fault handling proxy (which lets say is a separate proxy,proxy2 ) can call the API exposed by the emailer proxy via a Service Callout policy.

That way over period of time proxy1 can grow as a notifier proxy which will encapsulate all sorts of notifiers like email,sms,jira etc. each exposed via APIs which any other proxy will call.

ok thank you @sarthak.

If I'm going to use nodemailer in my nodejs proxy, do I need to configure/install the nodemailer in my proxy? If yes, please share us the steps to include it or share the infor if you have anything else like nodemailer to use it for sending emails. Thanks!

http://www.nodemailer.com/

http://blog.nodeknockout.com/post/34641712180/sending-email-from-nodejs

I would strongly suggest to read the documentations and watch the webinars to get a solid grip on node. Start from here : http://apigee.com/docs/api-services/content/overview-nodejs-apigee-edge

If you use https://www.npmjs.com/package/apigeetool for managing the deployments then it will automatically take care of dependencies. Or use this API to deploy the dependencies .

ok. I read the documentation and trying to import the libraries into by existing org by using the above API link for nodemailer and it's giving the below error. Is anything wrong in my command?

$ curl -X POST --header "Content-Type: application/x-www-form-urlencoded" --hea der "Authorization: Basic c3dhcG5hLmFkdXN1MDdAZ21haWwuY29tOk9tc2FpcmFtQDE=" -d "command=install nodemailer" "https://api.enterprise.apigee.com/v1/organization s/swapnaadusu07/apis/Hello-World-Nodejs/revisions/1/npm?verbose=true"

Error:

{ "code" : "messaging.config.beans.ApplicationDoesNotExist", "message" : "APIProxy named Hello-World-Nodejs does not exist in organization swapnaadusu07", "contexts" : [ ] }

It is working for all the below commands.

Valid npm commands that you can execute with this API are:

  • install
  • update
  • outdated
  • dedupe
  • prune

Thanks!

Try to run the command directly from the documentation. You will need a package.json file using which the dependencies will be resolved.

Or use the apigeetool which will do all the dependency resolution and create a zip file with those.

Not applicable

Thanks @sarthak. Executed API call from the documentation and attached are the screen prints of error and also getting 404 error in apigee deployment tool also. What was the wrong in the process? Thanks!

$ apigeetool deploynodeapp -u abc@xyz.com -o sdoe -e test -n 'Hello-World-Nodejs-2' -d . -m Hello-World-Nodejs-2.js -b /node2 Password: **********

Error: Proxy creation failed. Status code 404

Not applicable

Hi, Can anyone please advice on the below issue in nodejs api proxy?

I have implemented on API Proxy with Nodemailer module to send the notification and deployed it successfully in test environment. But I'm getting email notifications for every few minutes eventhrough I'm not trying to access that particular URL. But If I'm accessing URL then it always gives the below error.

URL: http://swapnaadusu07-test.apigee.net/hello-world-nodejs-6

Error: {"fault":{"faultstring":"Script node is still starting","detail":{"errorcode":"scripts.node.runtime.ScriptStillStarting"}}}

I believe, because of this error ("Script node is still starting") , I'm giving email for every few minutes.

Thank you!