0

when I called watson language translator service over a public network its responded with no error. meanwhile, its not able to get response body over my private network

I am using the NGINX has my load balancer and have configure a proxy_http for it on the configuration.

The error is

{ Error: Response not received. Body of error is HTTP ClientRequest object at formatError (root\node_modules\ibm-cloud-sdk-core\lib\requestwrapper.js:115:17) at D:\Rafiki Project\production build\Rafiki Production Files 1\ecobot-orchestrator-master_23_9-orch_persistency_fixes\node_modules\ibm-cloud-sdk-core\lib\requestwrapper.js:265:19 at process._tickCallback (internal/process/next_tick.js:68:7)

var languageTranslator = new LanguageTranslatorV2({
  username:'8******************',
  password:'*************',
  url: 'https://gateway.watsonplatform.net/language-translator/api/',
  version: '2017-05-26'
});

function translateToWSPLan(req, res, callback){
  console.log("the request for translation is::");
  console.log(JSON.stringify(req));
  console.log("======================");
  languageTranslator.identify(req.body.identifyParams, function(err, data){
    if(err){
      console.log('=================error==========');
      console.log(err);
      console.log('=================================');
      var errorLog = {name: err.name, message: err.message};
      callback(errorLog);
    }else {

    }
})
Afeez Olawale
  • 65
  • 4
  • 13
  • If the code above is working for the public network, then it is something with the configuration of your private network. Please share that configuration and other relevant details. – data_henrik Jul 17 '19 at 05:31

1 Answers1

0

See this issue raised on the Node.js SDK for Watson - https://github.com/watson-developer-cloud/node-sdk/issues/900#issuecomment-509257669

To enable proxy routing, add proxy settings to the constructor



var languageTranslator = new LanguageTranslatorV2({
  username:'8******************',
  password:'*************',
  url: 'https://gateway.watsonplatform.net/language-translator/api/',
  version: '2017-05-26',
  // other params...
  proxy: '<some proxy config>',
  httpsAgent: '<or some https agent config>'
});


If you take a look at the issue, then there is a problem with accessing IAM tokens which does not work when there is a proxy, but as you appear to be using a userid / password combination, you should be OK. That is until cloud boundary style credentials are suspended and superseded by IAM credentials for all existing Watson services.

chughts
  • 4,210
  • 2
  • 14
  • 27