Getting errors after adding the Bot in Teams - botframework

I'm getting errors after adding the BOT in teams. I have created a simple Hello default bot using the MS Teams Toolkit and Vs Code. The best part is whenever i'm creating any BOT and try to run it in Bot emulator then it is working fine which is on localhostwith 200 ok response but not in teams either i'm getting 404 or 500 in POST requests.
Can someone please help and through some light and tell me what i'm doing wrong here or what could be the possible cause of the errors.
ng-rok error log

Your bot looks like it's configured to reach your ngrok environment properly, so that's good, but it looks like the path is incomplete. You need to tell the Bot Framework the full path to the actual running endpoint in your app - it's usually something like https://[something].ngrok.io/api/messages, like the below screenshot:
Under the "messaging endpoint" section, see the full path. I suspect you only have the https://[something].ngrok.io part and not the /api/messages part.
You can see this because in your ngrok log that you've posted, the path is direct to the root (/), not to /api/messages or similar.

Related

Failed to send activity: bot returned an error 502 404

I'm trying to deploy the ms teams auth bot to azure. The bot gives a welcome message when I tested it using the bot framework emulator. Then I ran these steps to deploy my bot to azure. During the deployment steps, I used the same app id and password throughout the whole process. Then I tested it on azure and it just fails:
I look at my browser's network requests and I see this:
HTTP POST: https://webchat.botframework.com/v3/directline/conversations/JYtg14OvcjS7FiNwCMXzH1-g/activities
Response:
{
"error": {
"code": "BotError",
"message": "Failed to send activity: bot returned an error"
},
"httpStatusCode": 404
}
I streamed my application logs and it gave me a big HTML response you can see here. But it's just a 404 page response.
I tried to run this in my bot emulator, pointing to the bot in production and it gave a 404 response as well:
Edit:
I just tried to redeploy my bot but got the same results when testing my bot.
After running all the deployment steps, I never had a web.config file. Though testing it in my bot emulator locally works fine.
Here is a screenshot of my resource group, which has 3 resources:
Here is a screenshot after running the pre-deploy command. It doesn't generate a web.config file, but it generates a .deployment file:
The app ID is the same in app registrations portal in azure, and the same in my appsettings.json file, and the same when I ran the deployment command.
Edit 2:
Here is how I zipped my project:
On Azure, I'm not able to view my code while I remember that I used to do it before. Perhaps it's because on Azure, I only have a Bot Channels Registration but I don't have a Web App Bot. Is that a problem?
Edit 3:
I noticed I did not include the .deployment file when I zipped the contents. (The file explorer was hiding the file.) So now I included it in my zipped contents and redeployed by bot again. (Unfortunately, the bot is still behaving the same.)
Here are the new contents of /dev/wwwroot/:
Here is my app registration (I tried toggling both account types instead of re-recreating it through command line, still same bot behavior):
The .deployment file was zipped. My mac just didn't show it. I updated the screenshot to show my .deployment file above.
OPs issue ended up being that they need to make their App Registration available for ALL accounts, including personal. To do so, follow these steps
I'll keep the answer for posterity, but if you're running into this issue, my comments provide good troubleshooting steps.
Aha! The issue was this step. You need to zip up the contents of the project folder and not the folder itself.
This:
Instead of this:
When you deploy, your folder structure will look like this:
You aren't the first person to run into this. I've created a PR to clarify this. Let me know if you think the change I made should say something else.
Sidenote: The web.config is created upon deployment. My mistake with that comment.

BotBuilder - NLP with dispatch error No such host is known

I am new in using Bot Builder Framework. I was following this tutorial from Microsoft https://learn.microsoft.com/en-us/azure/cognitive-services/qnamaker/tutorials/integrate-qnamaker-luis.
I am using the code from GitHub(NLP-with-dispatch) and set up all the necessary requirements DISPATCH, Luis, Qnamaker, etc.
But after running the code using the bot emulator I got this error message.
"No such host is known".
BTW, I already updated the appsettings.json and bot config.
Anyone experience this?
I actually just created a PR for this, since the issue is so common.
With that sample, make sure that LuisAPIHostName in appsettings.json is just your LUIS region (ie westus).

Azure Bot Service - "An internal Error occured at the server"

I have created a bot service app in Azure that works fine when I create it. I go through the Microsoft App ID, password screen and it loads the chat emulator and code in browser (using the LUIS template and node.js language). After sometime, if I go back to load that app service from Azure dashboard, it keeps giving me "An Internal error occurred at the server" error message. I am not sure if I shouldn't be going to the newly created Bot Service from dashboard? I did this 3-4 times already, with new names, new RG etc., it's the same issue every time.
Thanks
Unfortunately this looks like a bug, there are are two open issues right now on the SDK's repo that look very similar to yours. Here is one of them; 'InternalServerError - Bot & QnA Maker'.
Regarding the downvote, it might be because there isn't a screenshot of the issue which usually helps in answering questions. Also, explaining the steps you undertook or compared against would have helped give a clearer picture for the community to answer.

How to resolve this issue "A potentially dangerous Request.Path value was detected from the client (:)."?

I am working on bot framework technology, in one of my project I implemented the concept of “Authorize access to web applications using OAuth 2.0 and Azure Active Directory” to my current bot.
It’s working in locally fine using bot framework channel emulator, after that I have published my bot into azure and added a skype channel to it.
Next I started to chat with my bot, when I click on this URL https://bankivrcallingbot.azurewebsites.net/api/29:1LFUEWsOCTRAjSGXvSbsESUgPgwwns4PUh7l8vgKP_znay9FRGiLd0Cm6xO5Undeo/login it shows Server Error in '/' Application and A potentially dangerous Request.Path value was detected from the client (:).
See the below screen shot for complete understand about my error.
Please tell how to resolve this error as soon as possible.
-Pradeep
The : character is not allowed in the path of the URL
My issue in Azure Data Factory was also about the : character.
I resolved the problem by substituting : with %3A
as shown here.
For example, I substituted
date1=2020-01-25T00:00:00.000Z
with
date1=2020-01-25T00%3A00%3A00.000Z

Bot Framework always getting unauthorized response

I started using Microsoft Bot Framework and followed step by step all tutorials.
I has been able to register a new bot and to deploy it working good with emulator, but except it nothing else works.
Test connection to your bot chat do not works despite I get answer from emulator and from all connected channels, that where created and registered properly I always get an Unauthorized response or something like that, anyway no response, so nothing works.
I tried with Twilio, Web Chat, Telegram (Skype auth is pending) getting always the same response.
As it seems I strictly followed the tutorials, is there something else to do or to be approved? Or just the service is still not working at 100% as too young?
Thanks
If you are using HTTP you need to disable basic auth because the connector won't send your appSecret in the clear.
The solution is to make sure you register as HTTPS, or if you need to use HTTP then disable the basic auth.
Took me a while to get it working locally too. Oddly for me it only works when those 'secret' fields are empty, as mentioned and running in debug.
Running without debugging seems to always result in a 401
Hi I was facing same problem to work bot locally in v3. I just made everything blank in web.config and it is working.
I solved the problem.
It was related to https. It's not well explained into tutorial but when you create and publish a service in Azure it is created as http://XXXXXXX.azurewebsites.net as shocased into tutorial, but it will not work as your service must run in https.
I so used https://startssl.com to create a free ssl certificate then turned on SSL into my Azure service so everything started working.
I've cleaned up the getting started with the following; hopefully it will make it clearer for the next person who uses it:
Click the “Register a Bot” button and fill out the form. Many of the fields on this form can be changed later. Use a the endpoint generated from your Azure deployment, and don’t forget that when using the Bot Application template you’ll need to extend the URL you pasted in with the path to the endpoint at /API/Messages. You should also prefix your URL with HTTPS instead of HTTP; Azure will take care of providing HTTPS support on your bot. Save your changes by hitting “Create” at the bottom of the form.
Make sure you are using HTTPS. BotFramework will not work with basic auth so tokens are not passed in the clear.
See: http://docs.botframework.com/connector/calling-api/
Make sure that you republish your bot service after registering and getting the app Id and password. If you fail to do this you will get Unauthorized. The steps are 100% clear on this and I hit this for a minute.

Resources