Code Monkey home page Code Monkey logo

Comments (6)

lukefx avatar lukefx commented on August 16, 2024

@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?

from hubot-telegram.

arcturial avatar arcturial commented on August 16, 2024

I shall do that

from hubot-telegram.

slackerzz avatar slackerzz commented on August 16, 2024

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)

from hubot-telegram.

manoamaro avatar manoamaro commented on August 16, 2024

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.

from hubot-telegram.

lukefx avatar lukefx commented on August 16, 2024

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
#52 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AABwzsA04dQ110vSfcG1zW7F3dxD7b3rks5qaTMCgaJpZM4JQoJF
.

from hubot-telegram.

arcturial avatar arcturial commented on August 16, 2024

Nice catch, thanks

from hubot-telegram.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.