Botframework-sdk: [Slack Channel] Connector API starts failing after re-adding Slack App with bot user

Created on 3 Apr 2017  路  12Comments  路  Source: microsoft/botframework-sdk

Connector API started throwing 500 responses after I removed and re-added a Slack App with a BotBuilder bot.

  • Added a Slack App with a bot user to a team
  • Exchanged couple of messages with the bot user
  • Removed Slack App from the team
  • Re-added the same App again
  • Now every message to my bot results in Internal Server Errors:
    Error: Request to 'https://slack.botframework.com/v3/conversations/B4TGPB3HQ%3AT4Q5YL2H2%3AD4SS5US7K/activities/3b66170a8ebb47ce8b3428d6870e0e60' failed: [500] Internal Server Error at Request._callback (/app/node_modules/botbuilder/lib/bots/ChatConnector.js:452:46)

15 minutes later tried again - no errors this time. ConversationId is the same as in falling messages.

Also I've had a bunch of issues in Slack Channel:
Bot integration B4TGPB3HQ:T4Q5YL2H2 failed to connect to Slack due to invalid credentials and will be disabled. Error: account_inactive

P.S. I've also noticed you now send installationUpdate messages after an App was added to a team, which is great! Any ideas on how to also get an Id of the user who authorized the App?

Most helpful comment

Seeing the same behavior as @lingz @DovydasNavickas. invalid_auth after a reinstall that goes away after some time.

All 12 comments

hi @delight-by - Thank you for reporting this issue in the Connector API. Can you provide additional details about your issue?

Environment

  • Operating System:

    • Windows

    • macOS

    • Linux

  • SDK Platform:

    • C#/.NET

    • Node.js

  • SDK version:
  • Development environment:

    • localhost

    • Azure Web App

    • Azure Bot Service App

    • other

  • If you are using the Node.js SDK:

    • Node.js version:

    • NPM version:

Issue

What the issue is, in broad strokes. Link to Stack Overflow post.

Example Code

The code snippet or complete bot example (preferred) that demonstrates the issue.

Steps to Reproduce

Please provide the shortest amount of steps to reproduce your issue.

Expected Behavior

What you expected to happen.

Actual Results

What actually happened. Please give examples and support it with screenshots, copied output or error messages.

I literally have all the information in my first post, with all the ids (just look at those logs). I'll just add that the bot is hosted on Heroku, all SDKs (botbuilder, node, etc.) are latest available (node is 7.8.0).

Also I've had a bunch of issues in Slack Channel: Bot integration B4TGPB3HQ:T4Q5YL2H2 failed to connect to Slack due to invalid credentials and will be disabled. Error: account_inactive

@delight-by based on your error message in Slack, it looks like your bot may have been disabled by Slack themselves.

When you say you "re-added" the app, do you mean that you deleted the Slack Channel configuration from your bot in the Bot Portal? And then you added back the Slack Channel configuration in the Bot Portal?

Or did you mean that you changed some configuration of your Slack Application in the Slack API page which then led to the error? If your error was triggered by configuration settings updated in your Slack Application via the Slack API page, it's possible the error is in the Slack API itself, and not in the Bot Framework or Bot Connector Service. Especially since you got the error about Slack API disabling your account, it sounds likely the issue is with Slack API.

@nwhitmont None of your assumptions are right. You can add a Slack App (with a bot) to a team, and then remove the app (with the bot) from the team. And then repeat. That's what you're doing now and then while testing the Slack channel. I can't describe it any simpler, and that's not connected anyhow with the Bot Framework configuration or Slack App configuration. That's what the end users on Slack channel are able to do any time after you've published your bot.

Str again:

  1. Added a Slack Bot (via Add To Slack button) to a team
  2. Removed that Slack App from the team
  3. Re-added the same bot to the same team again (= goto 1)

After step 2, the bot token you have from Slack gets invalidated hence the errors in Bot Portal - that's expected. What's wrong here is that when I add the bot to the team again (going through the whole OAuth process again) - I start getting errors from the Connector API, despite the fact that you should have new valid token at the moment.

the error about Slack API disabling your account

The error has nothing to do with that. It literally says that the credentials (the token you got as a result of OAuth process) got invalidated (due to user removing the app from their team). And that the bot integration (this particular bot on this particular team) will be disabled at BotFramework side (due to lack of valid credentials).

@delight-by I followed the same process you described in your last comment with my Slack bot & team but I'm unable to reproduce your error. Everything is working fine when I add/remove/add the bot to the Slack team using the "Add to Slack" button in the Bot Portal.

Can you link some screen shots of your workflow? Also, when you say you get errors from the Connector API, what are the errors and where do you see these errors specifically?

@nwhitmont I've shown you the stack trace I was getting from BotFramework:
Error: Request to 'https://slack.botframework.com/v3/conversations/B4TGPB3HQ%3AT4Q5YL2H2%3AD4SS5US7K/activities/3b66170a8ebb47ce8b3428d6870e0e60' failed: [500] Internal Server Error at Request._callback (/app/node_modules/botbuilder/lib/bots/ChatConnector.js:452:46)

I didn't dig deeper, and didn't look at the message that your server was probably sending alongside 500 status code, probably I should have to. Nevertheless, to be honest, today I was going through the same process again and didn't catch any errors too. So hopefully the problem has been solved already. I'll post again if it comes back.

@delight-by thanks for the update! reopen if it comes up again.

Can confirm that this happens to me too. After deleting and re-adding the bot several times, I'm unable to talk to it because of invalid_auth. It seems that the old token must be getting cached on the connector of MSFT side.

Yep, same here. Removed the app for holidays, because it started spamming replies to any message anywhere, now re-added and started getting invalid_auth.

And indeed some time has passed till while I was looking for solution and bot started working again. You're not invalidating some cache actively and we have to wait for it to be invalidated after some time (not sure even how much time).

Seeing the same behavior as @lingz @DovydasNavickas. invalid_auth after a reinstall that goes away after some time.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Arimov picture Arimov  路  3Comments

jschristophe picture jschristophe  路  3Comments

mattlanham picture mattlanham  路  3Comments

peterbozso picture peterbozso  路  3Comments

bluekite2000 picture bluekite2000  路  4Comments