No authorisation when using "Test connection to your bot" on the bot framework portal.
I have seen a number of questions here on the same subject, but still can't get this to work as it should. I am trying to ensure my endpoint authorisation works, but I keep getting errors...
I have followed the recommendations to the letter: https://docs.botframework.com/en-us/support/troubleshooting-bot-framework-authentication/
At first the error was;
InternalServerError
{
"message": "An error has occurred.",
"exceptionMessage": "Object reference not set to an instance of an object.",
"exceptionType": "System.NullReferenceException",
"stackTrace": "
(etc...)
I worked out that I needed to upgrade my azure plan to basic to include SSL. However, when i now test my bot connection via the bot framework portal I get;
InternalServerError
{
"message": "An error has occurred."
}
The bot itself works fine over Skype and webchat - Its just the authorisation piece that does not want to work.
Following the link from the web app hosted on azure, proves I have an HTTPS address. The only thing I have not tried is to purchase a dedicated SSL certificate for my app.
But, surely the basic Azure plans include SSL under the generic Microsoft certificate? Any thoughts?
One final piece of info, the webchat channel for the bot constantly shows me the following issue;
There was an error sending this message to your bot: HTTP status code
InternalServerError
Azure hosting, web app, b1 basic plan...
Ok, I managed to solve this by a process of elimination. The bad code is below (from MessagesController.cs);
if (activity.Type == ActivityTypes.Message || activity != null)
While the code runs happily, the endpoint authorisation trips over when it hits;
activity != null
Therefore, by reverting to the following endpoint authorisation works;
if (activity.Type == ActivityTypes.Message)
Don't ask me how the null check was in the code, I don't know! Or why authorisation doesn't like the null check..