azure-bot-serviceweb-chatbotkitbotkit-4

unable to connect botkit-based bot to BotFramework's webchat (401 errors)


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:


Solution

  • 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.