Looks like I cannot resolve cognition text translate IP address. Ping does not work either. Code example:
let fun = () => {
var key_var = 'mykey';
var endpoint_var = 'https://myendpoint.cognitiveservices.azure.com/translate';
let options = {
method: 'POST',
baseUrl: endpoint_var,
url: 'translate',
qs: {
'api-version': '3.0',
'to': ['de', 'it']
},
headers: {
'Ocp-Apim-Subscription-Key': key_var,
'Content-type': 'application/json',
'X-ClientTraceId': uuidv4().toString()
},
body: [{
'text': 'Hello World!'
}],
json: true
};
request(options, function (err, res, body) {
console.log(JSON.stringify(body, null, 4));
console.log('hello')
console.log(err);
});
}
fun();
console out: hello { Error: getaddrinfo EAI_AGAIN myendpoint.cognitiveservices.azure.com myendpint.cognitiveservices.azure.com:443 at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:57:26) errno: 'EAI_AGAIN', code: 'EAI_AGAIN', syscall: 'getaddrinfo', hostname: 'myendpoint.cognitiveservices.azure.com', host: 'myendpoint.cognitiveservices.azure.com', port: 443 }
myendpint
in the error you havemyendpoint
- typos are easy to make – Jaromanda Xmyendpoint
wasn't the real endpoint, I was making a point about typos :p if ping doesn't work, then it's definitely an DNS issue – Jaromanda X