-
Notifications
You must be signed in to change notification settings - Fork 2.3k
How to recover from a BotFrameworkAdapter message rejection (401 error)? #2200
Comments
It looks like there is not a great way to handle this error if you use the automatically created webhook endpoints. However, you can manage your own endpoint and call the adapter directly as seen in the example below: botkit/packages/testbot/multiadapter.js Line 53 in 9365023
|
@pgoldweic let me know if I can help more... |
Thanks @benbrown for your input here. I have two follow-up questions though: |
To do this, you actually need to set up your own instance of Express, then set up the That said, you can basically copy the code from inside Botkit: Alas, It is a little bit involved.
|
Thanks again @benbrown for your help. I'll check it out. |
@pgoldweic I created a sample that demonstrates how to use your own instance of Express, thus gain access to some of these internal features. https://github.com/howdyai/botkit/blob/main/packages/testbot/custom_express.js |
Perfect. Thanks @benbrown |
As I explained in a different post, when I try to connect my botkit bot to the BotFrameworkAdapter, the bot's log shows an unauthorized error. Independently of how to resolve that issue, my question here is how to recover from it, given that later versions of nodejs cause the bot script to exit given the unhandled exception within a promise (taking the bot down completely). Here's the complete stack trace for the error:
NOTE: I updated the nodejs version last week, resulting in this problem. In order to handle this exception properly, where should code be inserted for this purpose? Should this be part of the botkit codebase? I am really not too familiar with the internals to be able to tell where one could try to catch this type of exceptions. Any help will be appreciated.
Here are my bot's specs:
Botkit version: 4.10.0
Messaging platform: trying to connect to Azure Bot service (webchat channel is the aim) via botkit's BotFrameworkAdapter (web adapter works fine on original bot)
Node version: 16.14.0
OS: Windows (for development)
The text was updated successfully, but these errors were encountered: