plainheart / bing-translate-api

A simple and free API for Bing & Microsoft Translator for Node.js
https://github.com/plainheart/bing-translate-api
MIT License
156 stars 28 forks source link

failed to fetch IG and IID RequestError: connect ECONNREFUSED 127.0.0.1:443 #4

Closed SarkarKurdish closed 3 years ago

SarkarKurdish commented 3 years ago

Can't translate anything getting this error when using the main function

translate('hello', null, 'ar', true).then(res => { console.log(res.translation); }).catch(err => { console.error(err); });

plainheart commented 3 years ago

Any error information? I tried and got the result,

{
  text: 'hello',
  userLang: 'auto-detect',
  translation: 'مرحبًا',
  language: { from: 'en', to: 'ar', score: 1 },
  correctedText: ''
}
plainheart commented 3 years ago

Sorry for missing the title. It seems you are connecting to 127.0.0.1. The resolved IP by DNS looks incorrect.

SarkarKurdish commented 3 years ago

I didn't change anything and i dont remember changing anything related to DNS or other stuff so,i did a little search looks like people had same issue with got and http-proxy-agent so what I'm suppose to do?

plainheart commented 3 years ago

So is your program running behind a proxy? If not, can you access the official website https://bing.com/translator? If neither, I'm afraid it's because your ISP has a limit for the bing website. Maybe you could try to modify your Windows/Mac's host file to specify the IP of bing.com manually.

SarkarKurdish commented 3 years ago

I can go to bing.com normally and do translations and I don't have any proxy turned on and i tried to set the ip manually it didn't work

plainheart commented 3 years ago

It seems some other libraries (for example, node-agent-base) patched the core NodeJS method. Please check if this library is required somewhere and try to upgrade related dependencies. See sindresorhus/got#951

SarkarKurdish commented 3 years ago

Thanks that was the issue http-proxy-agent was already installed and some how made this error happen after changing to new project the problem solved.