Skip to content
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

Hubot dies when reply a huge message #135

Closed
jtomaszon opened this issue Dec 27, 2014 · 3 comments
Closed

Hubot dies when reply a huge message #135

jtomaszon opened this issue Dec 27, 2014 · 3 comments

Comments

@jtomaszon
Copy link

Hey @ALL.
I don't know if this is a bug, but I'm trying to use hubot to reply a simple message with code: url:.
At the moment I just create a big array on the brain with:
[{code: "foo", url: "https://foo.bar"}, ...1000 more objects...]
We I called from the Slack, the first 17-20 items shows, and hubot exists with this output:

[Sat Dec 27 2014 21:21:37 GMT+0000 (UTC)] ERROR Received error [object Object]
[Sat Dec 27 2014 21:21:37 GMT+0000 (UTC)] ERROR undefined
[Sat Dec 27 2014 21:21:37 GMT+0000 (UTC)] ERROR Exiting in 1 second
[Sat Dec 27 2014 21:21:37 GMT+0000 (UTC)] ERROR Received error [object Object]
[Sat Dec 27 2014 21:21:37 GMT+0000 (UTC)] ERROR undefined
[Sat Dec 27 2014 21:21:37 GMT+0000 (UTC)] ERROR Exiting in 1 second
[Sat Dec 27 2014 21:21:37 GMT+0000 (UTC)] ERROR Received error [object Object]
[Sat Dec 27 2014 21:21:37 GMT+0000 (UTC)] ERROR undefined
[Sat Dec 27 2014 21:21:37 GMT+0000 (UTC)] ERROR Exiting in 1 second
[Sat Dec 27 2014 21:21:37 GMT+0000 (UTC)] ERROR Received error [object Object]
[Sat Dec 27 2014 21:21:37 GMT+0000 (UTC)] ERROR undefined
[Sat Dec 27 2014 21:21:37 GMT+0000 (UTC)] ERROR Exiting in 1 second
[Sat Dec 27 2014 21:21:37 GMT+0000 (UTC)] ERROR Received error [object Object]
[Sat Dec 27 2014 21:21:37 GMT+0000 (UTC)] ERROR undefined
[Sat Dec 27 2014 21:21:37 GMT+0000 (UTC)] ERROR Exiting in 1 second
[Sat Dec 27 2014 21:21:37 GMT+0000 (UTC)] ERROR Received error [object Object]
[Sat Dec 27 2014 21:21:37 GMT+0000 (UTC)] ERROR undefined
[Sat Dec 27 2014 21:21:37 GMT+0000 (UTC)] ERROR Exiting in 1 second
[Sat Dec 27 2014 21:21:37 GMT+0000 (UTC)] INFO Slack client closed

Even DEBUG mode doesn't show anything..
How could I help you to understand the error and fix it?

Thanks!

@jtomaszon jtomaszon changed the title Hubot dies after big response Hubot dies when reply a huge message Dec 27, 2014
@jtomaszon
Copy link
Author

I don't know if this is the best option to send an array with 50-100 objects to Slack..
If not, how is the best way to do?

  robot.respond /customers/, (r) ->
    for h, i in customers
      r.send "#{i + 1} - *#{h.code}* #{h.url}"

@jtomaszon
Copy link
Author

This helps me this time :)

  robot.respond /customers/, (r) ->
    message = ""
    for h, i in customers
      message += "#{i + 1} - *#{h.code}* #{h.url}\n"
    r.send message

@evansolomon
Copy link
Contributor

You're trying to send a non-string, which I suspect doesn't work that well, and the error message you're getting matches what happens when you try to stringify data with non-primitive types.

> [{code: "foo", url: "https://foo.bar"}].toString()
'[object Object]'

I bet if you do something like msg.send JSON.stringify(someGiantArray) you'll get a better result. Note: your message may end up getting split into multiple parts because of a limit in Slack's API for message size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants