connect ECONNREFUSED 127.0.0.1:1080
Bug Report
I have read:
I am using the latest version of the library.
Expected Behavior
I tried use Telegram bot throught SOCKS 5 proxy, but I got this error message: "Unhandled rejection RequestError: Error: connect ECONNREFUSED 127.0.0.1:1080@
Actual Behavior
When I start the bot it works 5 seconds and then I get error message "Unhandled rejection RequestError: Error: connect ECONNREFUSED 127.0.0.1:1080"
I have searched for the errors like that in issues of proxy usage and found none.
Example of request
I use socks5-https-client like @nskondratev recommended in this message: https://github.com/yagop/node-telegram-bot-api/issues/562#issuecomment-382313307
const Agent = require("socks5-https-client/lib/Agent");
var bot = new TelegramBot(appConfig.token, {
webHook: {
port: appConfig.webhook.port
},
request: {
agentClass: Agent,
agentOptions: {
socksHost: appConfig.proxy.hostname,
socksPort: appConfig.proxy.port,
socksUsername: appConfig.proxy.login,
socksPassword: appConfig.proxy.password
}
}
});
What problem can it be? Why is there request to localhost (I think that 127.0.0.1 is localhost)? How can I solve this issue. I can't find the reffernce of this ip address in the code of the module.
I supposed that the problem is the proxy what I use, but when I use another proxy the problem was again. I tried another method for proxy by property "request".
var bot = new TelegramBot(appConfig.token, {
webHook: {
port: appConfig.webhook.port
},
request: {
proxy:'http://secret@hostname:port'
}
});
It think that it work, but my bot doesn't answer my messages. I try to log message in the function for bot.on('message'), but the debug console keeps silence. What do you think? What problem can it be? Please, help me.
This is works https://github.com/yagop/node-telegram-bot-api/issues/562#issuecomment-445222580