Error while retrieving data from Backend [NODE JS --HOSTED TARGET]

Hi all,

I have proxy which was designed based on HOSTED TARGET.

I was able to connect to hosted target but while retrieving im getting the below response as following,

{

"fault":

{ "faultstring": "Server Error : getaddrinfo ENOTFOUND \"NameofTargetServer\"

\"NameofTargetServer\":80 (500)", "detail": { "code": 500 }

}

}

Would anyone here to assist me in resolving the issue.??

Thanks and Regards,

Mani

0 4 1,811
4 REPLIES 4

Hey Mani,

It looks like a request is failing going to "NameOfTargetServer:80". The getaddrinfo ENOTFOUND is coming from the node.js code (the HT), so I'm guessing you're making a request in your HT and "NameOfTargetServer" is a string that was supposed to be replaced.

HI @bowenjosh,

Thanks for the response,

But the issue hasn't been resolved yet, although i have removed stringify method

before: var backend=JSON.stringify(myargs[0]);

after: var backend=myargs[0];

Im getting the same response.


var options =

{

host: backEnd,

port: 80,

path: Path, method: 'POST',

headers: {

'SOAPAction': soapAction,

'Content-Type': 'text/xml',

'Accept': '*/*',

'Content-Length': soapRequest.length

}

};


This is how my code looks like(its a connecting part i have shown).

i just want more about this error "getaddrinfo ENOTFOUND".

Please help me with this

I think you haven't understood Josh's diagnosis. He didn't mention anything about JSON.stringify().

Let me try again, to tell you in a different way. Somewhere in your nodejs code - somewhere in the code YOU control - there is an attempt to connect to a server named "NameOfTargetServer".

THAT is what is failing. It's failing because "NameOfTargetServer" isn't a real DNS name.

Where does this name come from? It's impossible for us to know, but YOU can determine that. It's possible that this string is hard-coded into your nodejs code. It's also possible that the API Proxy is passing that string into the nodejs HT code.

Only you know.

Thank you very much @Dino-at-Google for making me understood what might have happened inside the node js code.

I'am fetching the NameOfTargetServer (ex: abc.xyz.com) from Yaml file. I checked the run time logs there i could view the backend getting properly populated.

Im pretty much sure there is error while connecting to server.

My doubt is if dns has not been property set up for the "NameOfTargetServer" then what kind of error we will get ? is this same as what i mentioned i,e getaddrinfo ENOTFOUND.

What ever the code i had in ONPREM node js (where it contains apigee-access), and its working as expected. But i migrated the same with HOSTED TARGET feature in cloud. I'm sure that i have replaced the trireme related code to appropriate convention. I checked the logs they properly got set..

Im wondering whether this is DNS issue or error in code.

Thanks in advance