-
-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
getting a polling error: aggregate error #345
Comments
I guess I remember having seen a similar thing when connection was lost or rejected due to network failure. Not 100% sure |
thanks for the reply, i tried running on a test PC in the same network before-hand and seems to be fine. just hoping that i dont have to swap out the whole thing |
Seeing similar issue since update to 15.1.9
If i turn poling off in config the error stops |
This indicates that you used the same token in several places. The server does not like if the messages are polled by two parties |
please try with new version 16.0.0 |
node-red-contrib-telegrambot
|
@duycop can you reproduce it? |
tl;dr Add to environment variable For me it was this Nodejs bug when connection via ipv4 is slow (>250ms) & ipv6 is unrouted. (nodejs/node#54359) How did I end up here?I had this immediately after a node-red upgrade (v2 to v3 to v4) and node-red-contrib-telegrambot upgrade (v14.? to v16.1.3). This would have upgraded the Node version and introduced the bug. How did I find this?Logs were very poor. I put this disgrace in let tgbe=require('node-telegram-bot-api/src/errors');
class FatalError extends tgbe.BaseError {
constructor(data) {
const error = (typeof data === 'string') ? null : data;
const message = error ? error.message : data;
super('SLIGHTLYBETTEREFATAL', message);
if (error) this.stack = error.stack;
if (error) this.cause = error;
}
};
tgbe.FatalError=FatalError; And logged a deeper inspect of the error. --- 99-telegrambot.js
+++ 99-telegrambot.js
@@ -3,8 +3,6 @@
// Avoid that node-telegram-bot-api will enable automatci promise cancellation (fix for 0.30.0 api)
process.env['NTBA_FIX_319'] = 1;
+require('./patch-efatal')
+
module.exports = function (RED) {
'use strict';
@@ -442,8 +440,6 @@
if (self.verbose) {
self.warn(error.message);
+ self.warn(require("node:util").inspect(error,{depth:5}));
}
let stopPolling = false; At this point, I was getting logs showing AggregateError for IPv4 timeout and IPv6 unreachable.
It was "timing out" ipv4 almost immediately - sub-second. Which didn't feel like a "normal" http connection timeout (I connect around the globe often enough to know some places are 1/2 a second just to tcp connect). And I could And yes, I am over 250ms RTT to telegram api servers: $ sudo ping api.telegram.org
PING api.telegram.org (149.154.167.220) 56(84) bytes of data.
64 bytes from 149.154.167.220 (149.154.167.220): icmp_seq=1 ttl=45 time=286 ms
64 bytes from 149.154.167.220 (149.154.167.220): icmp_seq=2 ttl=45 time=282 ms
64 bytes from 149.154.167.220 (149.154.167.220): icmp_seq=3 ttl=45 time=286 ms Added environment variable |
@ivanjh Thanks for your great work! |
A quick search in the issues on this repo shows a fair bit of Step 1:We need to log the error in a more detailed fashion. The Step 2 (best & slowest):The best way would be for the or Step 2 (nasty & quick):You could do exactly what I did and override their FatalError Class with a patched version that sets or Step 2 (both)Do both. Immediately release a patching version. Then, raise a PR to retain the causing error on |
@ivanjh I applied you patch: thanks alot. Waiting for your pull request in node-telegrambot-api: |
@windkh Nice work. This will allow anyone getting I've been using |
@ivanjh thanks, would not have been possible without your help :) |
Hi im getting this error when deploy my telegram bot, has anyone seen this before? ive used this package for multiple computers and its the first time im encountering this
Unhandled rejection RequestError: AggregateError
at new RequestError (C:\Users\USER\node_modules\request-promise-core\lib\errors.js:14:15)
at plumbing.callback (C:\Users\USER\node_modules\request-promise-core\lib\plumbing.js:87:29)
at Request.RP$callback [as _callback] (C:\Users\USER\node_modules\request-promise-core\lib\plumbing.js:46:31)
at self.callback (C:\Users\USER\node_modules\request\request.js:185:22)
at Request.emit (node:events:514:28)
at Request.onRequestError (C:\Users\USER\node_modules\request\request.js:877:8)
at ClientRequest.emit (node:events:514:28)
at TLSSocket.socketErrorListener (node:_http_client:495:9)
at TLSSocket.emit (node:events:514:28)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
The text was updated successfully, but these errors were encountered: