Node.js service callout does not work after deploying

The Service Callout Policy now has the ability to directly invoke a Node.js resource instead of going through a chained Node.js proxy. However, I'm having issues when I attempt to edit the proxy and re-deploy.

My Node resource is rather simple, pretty much the same as the Hello World example:

var http = require('http'); 
 
console.log('node.js application starting...'); 
 
var svr = http.createServer(function(req, resp) { 
    resp.setHeader('Content-Type', 'application/json'); 
    resp.end(JSON.stringify({"data" : "test"})); 
}); 
 
svr.listen(9000, function() { 
    console.log('Node HTTP server is listening'); 
});

I can deploy it the first time without issue, but as soon as I make an edit and then Save, I get an error message when Apigee attempts to deploy:

"The revision is deployed, but traffic cannot flow. Unexpected error occurred while processing the updates."

From then on, I cannot deploy my proxy without deleting (or commenting out) the node code. Even deleting the Service Callout Policy, saving as a new revision, creating it again, and changing the port in Node doesn't work.

Am I doing something wrong?

Solved Solved
0 3 472
1 ACCEPTED SOLUTION

Hi @Dan nemec,

Sorry about the trouble you're having, but I think that adding <ScriptTarget> to a Service Callout policy is unsupported in Edge (and it was purposely removed from the docs a few months ago). I think the "Node.js" option for Service Callout is a UI bug. When I learn more, I'll update my answer. I don't think what you're trying to do is supported though.

View solution in original post

3 REPLIES 3

Hi @Dan nemec,

Sorry about the trouble you're having, but I think that adding <ScriptTarget> to a Service Callout policy is unsupported in Edge (and it was purposely removed from the docs a few months ago). I think the "Node.js" option for Service Callout is a UI bug. When I learn more, I'll update my answer. I don't think what you're trying to do is supported though.

Thanks. I saw a few questions here mentioning that no such feature existed, but they were all from months ago so I (wrongly) concluded that it was simply a new feature (see here for a screenshot of the UI).

Not applicable

@wwitman What alternatives are available in that case? I want to use ServiceCallout to call a back end API to determine whether current request should be processed or not. The back end API is not available yet so I was thinking I can mock it using <ScriptTarget> which is not supported as you confirmed. How do I go about doing this? This back end API I am trying mock cannot be exposed as API Proxy as it is an internal API.