-
Notifications
You must be signed in to change notification settings - Fork 2.3k
bot.say fails when using middleware (dashbot) #683
Comments
@alecl what repo are you testing this with? I tried to reproduce with my bot (using Botkit 0.4.7 and Dashbot 0.6.1) but didn't see the error. The
|
Super weird. I pulled https://github.com/howdyai/botkit-starter-slack and wasn't able to repeat. Then I messed with the versions of dashbot back and forth and now I can't get it to stop happening even on a fresh pull in a new directory. I found the root cause though. First off there's a missing error check here which obscured the problem https://github.com/howdyai/botkit/blob/master/lib/CoreBot.js#L1031 I added it like this and this is the error I am seeing when dashbot is enabled. Not sure if this is the error style that's appropriate. If so happy to PR it.
This is the area in dashbot.js where the issue is: https://github.com/actionably/dashbot/blob/master/src/dashbot.js#L176
The problem is bot.identity doesn't have the info:
and bot.team_info doesn't exist at call blowing up Creating a bot worker with the token in this manner causes these fields to not to be filled in. When you add the bot to the channel instead for instance, they are filled in by testbot.api.auth.test in components/user_registration.js
Sooo... I can recreate the identity and team_info structures on the bot loading from storage when needed like this and now it works all of the time. I'm not certain why this workaround is needed but it works.
|
Aha.. Interesting, I wasn't able to reproduce the bug either so thanks for digging into this... |
Added #691 to at least have the error logging in place that made the situation confusing in the first place and seeing if Ben has any idea why identity and team_info are missing at times. |
@alecl When spawning a bot right now, team_info is not set unless you start the RTM. Which is left over from how things worked under RTM. Under Events API, we are setting the team_info and identity inside the handleWebhookPayload function after spawning a bot to respond to a message received at the webhook. It's acceptable to spawn a bot without a bot identity (slash commands for example), and that seems to have led to attaching team_info and identity elsewhere under Events API. Leaving you with a Not sure what is appropriate here as a fix, either set team_info on spawn, or have dashbot look in |
Same happens with a facebook bot: |
Ok.. we're taking a look at this and will update with a fix soon. |
@jonchurch @alecl This is Ito at Dashbot. Ive modified the library to send us information that the team is unknown so as to not fail in this instance and still get information back to dashbot for analytics. Can you give it a try to use an alpha version of the dashbot library and see if it clears up the problem on your end before i push it as the new version of the dashbot library should just require a thanks |
@itozapata sorry for the long delay. Confirmed fixed not crashing. However, I'm still going to be running my fallback code to fill in the info as I'd rather have as much as possible in dashbot and not lose the team. |
Thanks Alec!! |
Happening with 0.4.7 and latest 0.5.1. Worked fine before putting in a dashbot API key. My bot is based on the Slack starter from howdy.
I'm running this after controller.startTicking().
After hitting the startupBot.say link it then fails here where worker is null so .send isn't valid.
botkit/lib/CoreBot.js
Line 1031 in 0188c5b
If I remove the DASHBOT_API_KEY all is fine again.
The text was updated successfully, but these errors were encountered: