Closed arcturial closed 8 years ago
@arcturial strange...my bot is running with 0.1.1 for a while and I never seen this error...
By looking at the code the exception is thrown at 143 and 150, where we split messages in chunks recursively...can you try to set HUBOT_LOG_LEVEL=debug
for a few days?
I shall do that
i have the same problems of @arcturial i found that after removing
res.envelope.telegram = {
parse_mode: 'HTML',
reply_markup: {
keyboard: [['option1', 'option2']]
}
};
my bot works again.
Before the error was:
[Tue Jul 26 2016 01:01:35 GMT+0200 (CEST)] DEBUG Message 'bot command' matched regex //command/i/; listener.options = { id: null }
[Tue Jul 26 2016 01:01:35 GMT+0200 (CEST)] DEBUG Executing listener callback for Message 'bot command'
[Tue Jul 26 2016 01:01:36 GMT+0200 (CEST)] DEBUG Message length: 90
[Tue Jul 26 2016 01:01:36 GMT+0200 (CEST)] DEBUG Message parts: 1
[Tue Jul 26 2016 01:01:36 GMT+0200 (CEST)] ERROR RangeError: Maximum call stack size exceeded
at Object.stringify (native)
at TelegramBot.request (/bot/node_modules/telegrambot/lib/telegrambot.js:75:53)
at TelegramBot.invoke (/bot/node_modules/telegrambot/lib/telegrambot.js:95:32)
at send (/bot/node_modules/hubot-telegram/src/telegram.coffee:143:9, <js>:165:28)
at Telegram.apiSend (/bot/node_modules/hubot-telegram/src/telegram.coffee:150:5, <js>:171:14)
at Telegram.send (/bot/node_modules/hubot-telegram/src/telegram.coffee:160:5, <js>:189:19)
at runAdapterSend (/bot/node_modules/hubot/src/response.coffee:82:34, <js>:87:50)
at allDone (/bot/node_modules/hubot/src/middleware.coffee:44:37, <js>:34:16)
at /bot/node_modules/async/lib/async.js:274:13
at Object.async.eachSeries (/bot/node_modules/async/lib/async.js:142:20)
at Object.async.reduce (/bot/node_modules/async/lib/async.js:268:15)
at /bot/node_modules/hubot/src/middleware.coffee:49:7, <js>:37:22
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
It's happening when we put any extra params to res.envelope.telegram
. Starting at line 72 (telegram.coffee), there is this method toString(object)
that is called only when there is any extra.
toString = (object) ->
result = {}
try
for key in Object.keys(object)
result[key] = toString(object[key])
catch e
result = "" + object;
return result
if extra?
extra = toString(extra)
...
Not sure if it should work the same as JSON.stringify(obj)
, but actually it's returning a huge recursive object. The telegrambot already parses this extra to string using JSON.stringify(obj)
(where the error occurs), so I think this code is not necessary anymore. I can submit a PR to remove this. Already tested here, and worked.
Oh ok, perfect if you send a PR I will test it and merge it right away...
Am Freitag, 29. Juli 2016 schrieb Manoel de A.L. Amaro :
It's happening when we put any extra params to res.envelope.telegram. Starting at line 72 https://github.com/lukefx/hubot-telegram/blob/master/src/telegram.coffee#L72 (telegram.coffee), there is this method toString(object) that is called only when there is any extra.
toString = (object) -> result = {} try for key in Object.keys(object) result[key] = toString(object[key]) catch e result = "" + object; return result if extra? extra = toString(extra)
...
Not sure if it should work the same as JSON.stringify(obj), but actually it's returning a huge recursive object. The telegrambot already parses this extra to string using JSON.stringify(obj) (where the error occurs), so I think this code is not necessary anymore. I can submit a PR to remove this. Already tested here, and worked.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/lukefx/hubot-telegram/issues/52#issuecomment-236049039, or mute the thread https://github.com/notifications/unsubscribe-auth/AABwzsA04dQ110vSfcG1zW7F3dxD7b3rks5qaTMCgaJpZM4JQoJF .
Nice catch, thanks
Started receiving this error once I upgraded to 0.1.1
Haven't had time to debug in detail yet, rolling back to 0.1.0 solved the problem...so I am assuming it's something in the new release.