AskYous
AskYous

Reputation: 4730

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:

enter image description here

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:

enter image description here

Edit:

  1. I just tried to redeploy my bot but got the same results when testing my bot.
  2. After running all the deployment steps, I never had a web.config file. Though testing it in my bot emulator locally works fine.
  3. Here is a screenshot of my resource group, which has 3 resources: enter image description here
  4. Here is a screenshot after running the pre-deploy command. It doesn't generate a web.config file, but it generates a .deployment file: enter image description here
  5. 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:

  1. Here is how I zipped my project: enter image description here
  2. 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:

  1. 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.)
  2. Here are the new contents of /dev/wwwroot/: enter image description here
  3. Here is my app registration (I tried toggling both account types instead of re-recreating it through command line, still same bot behavior): enter image description here
  4. The .deployment file was zipped. My mac just didn't show it. I updated the screenshot to show my .deployment file above.

Upvotes: 0

Views: 2786

Answers (1)

mdrichardson
mdrichardson

Reputation: 7241

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:

enter image description here

Instead of this:

enter image description here

When you deploy, your folder structure will look like this:

enter image description here

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.

Upvotes: 1

Related Questions