Angush / trellobot

A Discord bot for logging Trello events. Note: this is no longer functional and not maintained. Forks may be more up-to-date.
52 stars 46 forks source link

TypeError: resp.reverse is not a function #4

Open Wooza42 opened 5 years ago

Wooza42 commented 5 years ago

Hello,

I tried installing the trellobot on my debian 9 machine but I am not able to run it. After setting up the config and starting the bot, this shows up:

== Bot logged in as @Trellobot#2254. Ready for action! == /home/sargon/trellobot/node_modules/trello-events/index.js:71 var boardActions = resp.reverse(); ^

TypeError: resp.reverse is not a function at /home/sargon/trellobot/node_modules/trello-events/index.js:71:27 at Request._callback (/home/sargon/trellobot/node_modules/node-trello/lib/node-trello.coffee:60:16) at Request.self.callback (/home/sargon/trellobot/node_modules/request/main.js:122:22) at Request.emit (events.js:182:13) at Request. (/home/sargon/trellobot/node_modules/request/main.js:661:16) at Request.emit (events.js:187:15) at IncomingMessage. (/home/sargon/trellobot/node_modules/request/main.js:623:14) at IncomingMessage.emit (events.js:187:15) at endReadableNT (_stream_readable.js:1092:12) at process._tickCallback (internal/process/next_tick.js:63:19)

midnightlovell commented 5 years ago

same problem here. I dont know what to do.

guilhermeurnau commented 5 years ago

Same, waiting for too :(

Angush commented 5 years ago

@midnightlovell @guilhermeurnau are you both on Linux as well?

mauzao9 commented 5 years ago

@midnightlovell @guilhermeurnau are you both on Linux as well?

Same with me, and yes, but the bot runs smoothly for a while it just crashed once or twice with that same error.

Wooza42 commented 5 years ago

I would love to getting this bot running but in my case it doesn't even run longer than some seconds before crashing with the above message. If there is more I can do to help troubleshooting, let me know.

Angush commented 5 years ago

I wasn't able to recreate this, but a friend of mine did bump into it. She managed to fix it by limiting the number of actions Trellobot fetches from the API. So, @midnightlovell @guilhermeurnau @mauzao9 @Wooza42, if you guys are still trying to get it going, you might be able to fix it by doing the same.

To do so, head into /node_modules/trello-events/index.js and edit the first line of the getBoardActivity function to add ?limit=n to the end (so it reads trello.get('/1/boards/' + boardId + '/actions?limit=n', function(err, resp){) where n is the action limit. I'd recommend setting it to something moderately high, like 30 or 50.

The caveat to this is that if the bot isn't running constantly (eg. it crashes or your host machine goes down or internet drops or whatever else), and there's a lot of activity going on in your Trello board, it will only log the 30/50/n most recent actions, and not any before that.

JakeyPrime commented 5 years ago

Sorry for the late post to this, but I'm also getting this error on Ubuntu 18.04. Followed the steps to a tee, followed your steps in the previous reply (set it to 30) and it's crashing on startup.

Any other pointers?

Edit: I managed to get it to post like 20 messages by lowering it to like 25, but before it got to the last 5, it crashed with the same error.

mauzao9 commented 5 years ago

@Angush sadly it still constantly crashes, there is deff something wonky as to how the script is trying to get data and Trello doesn't like it heh

fallengravity commented 5 years ago

So I did everything mentioned in the thread and it worked perfectly for about 2 weeks, Then all hell broke loose one night and it had connected to discord API over 1000 Times in under 10 min needless to say the rest my token now whenever I try and connect it they almost instantly reset the token and email me. Something is definitely not right!

BUT

The bot is awesome when it does work, thank you for your hard work @Angush

mauzao9 commented 5 years ago

Yes this bot is the best bot I have seen, the way it can connect the discord accs to trello accs and the ease to customize the card embeds is better than anything else I've seen, but it really needs that fix, something is messing up and both Trello and Discord seem to not like it as I also got the token revoked once haha

jackalyst commented 4 years ago

I seem to get the json truncated, which is why it would have trouble

,"type":"updateCard","d
/home/qrlbutler/trellobot/node_modules/trello-events/index.js:76
        var boardActions = resp.reverse();
                                ^

The last three times it happened, I threw the output into a bytecounter and found they were right around 14,966 bytes. Not sure if that's related.

orhalimi commented 4 years ago

Yea happened to me too. Ran it on 512kb machine ^^" anyway using @Angush suggestion and reduce it to like 15 solved the issue. Really great bot.

Cheers!