Reputation: 467
After successfully connecting my locally hosted (botkit-based) bot to Microsoft's Bot Framework Emulator (using a localhost address for the messaging endpoint), I'm now trying to connect it to the framework's webchat (using an ngrok's hostname for my local bot). However, I get an 'unauthorized' when webchat tries to connect. More on my bot:
Here's what I've tried so far:
In all those cases my bot's own log displays the same: "Experienced an error inside the turn handler Error: BotFrameworkAdapter.processActivity(): 401 ERROR Error: Unauthorized. Invalid AppId passed on token: blah".
The browser console shows different results for the last case compared to the website embeds as follows:
So here are my immediate questions:
Aside from the above questions, do you have any other suggestions on what could be wrong/missing in my environment? BTW, by now I believe I have read all of the similar posts that refer to 'unauthorized' errors while using webchat and none of them has helped so far, including those referenced in the first comment provided below. For the record, here are the posts (not mentioned in the comment) that I've also read:
Upvotes: 0
Views: 585
Reputation: 467
After all the time spent debugging this issue, it turned out to be a simple typo in the botkit controller creation code. Instead of having it use 'adapterConfig' to set the bot's adapter to the built-in bot framework adapter, it was using 'adapter_config'. This was breaking the integration with the bot framework, as no app Id or password were being passed on. Thanks to Microsoft Support for troubleshooting help.
Upvotes: 0
Reputation: 5159
• I will suggest you to please check the below Github community forum for details on your issue regarding the turn handler and the ‘BotFrameworkAdapter.processActivity():401 ERROR’ in which they state that they tried to connect through two types by local bot: -
In the above two types of connections made, the 1st one always fails while the 2nd one executes successfully always. So, according to them, they are suggesting downloading the latest version of Emulator over.
https://github.com/microsoft/BotFramework-Emulator/issues/1417
Kindly refer to it as it may be helpful to you. And as far as ‘Test in webchat’ feature is concerned, it does require an Azure hosted bot because the Bot Framework Emulator that runs on the local device has the Azure Bot service endpoint link embedded in its runtime configuration for which during the execution of the emulator, we have to enter the AppID and password of the Azure Bot service to connect to.
https://learn.microsoft.com/en-us/composer/test/test-bots-in-web-chat
Upvotes: 1