question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Messaging extension bot example getting 501 Error

See original GitHub issue

Versions

botbuilder version: 4.9.0 nodejs version: 14.0.5 os: mac

Describe the bug

I am trying to create a messaging extension action command feature with the following tutorial: https://docs.microsoft.com/en-us/microsoftteams/platform/task-modules-and-cards/task-modules/task-modules-bots

However, I am keep getting the following bug when invoking from Microsoft teams

(node:65410) UnhandledPromiseRejectionWarning: Error: BotFrameworkAdapter.processActivity(): 501 ERROR
    at BotFrameworkAdapter.<anonymous> (/Users/kevin/Desktop/Github/jibee/node_modules/botbuilder/lib/botFrameworkAdapter.js:677:27)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/kevin/Desktop/Github/jibee/node_modules/botbuilder/lib/botFrameworkAdapter.js:11:58)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(Use `node --trace-warnings ...` to show where the warning was created)

The code example I am using bot.js


import { BotFrameworkAdapter } from 'botbuilder';
import { TeamsMessagingExtensionsActionBot } from './teamsMessagingExtensionsActionBot';

const taskModuleController = new BotFrameworkAdapter({
    appId: process.env.APP_ID,
    appPassword: process.env.APP_PASSWORD
});

const bot = new TeamsMessagingExtensionsActionBot();

controller.webserver.post('/task_endpoint/', (req, res) => {
    taskModuleController.processActivity(req, res, async (context) => {
        console.log(context);
        await bot.run(context);
    });
});

teamsMessagingExtensionsActionBot.js

const { TeamsActivityHandler, CardFactory } = require('botbuilder');

export class TeamsMessagingExtensionsActionBot extends TeamsActivityHandler {
    handleTeamsMessagingExtensionSubmitAction(context, action) {
        return {
          task: {
            type: 'continue',
            value: {
              width: 500,
              height: 450,
              title: 'Task Module Fetch Example',
              url: 'https://contoso.com/msteams/taskmodules/newcustomer',
              fallbackUrl: 'https://contoso.com/msteams/taskmodules/newcustomer'
            }
          }
        };
    }
}

[bug]

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
kevinyang372commented, Jun 4, 2020

I realized there was an error in my manifest where I misdefined the dynamic parameters input to be static which caused the resource error. Thank you for all the help!

0reactions
mdrichardsoncommented, Jun 2, 2020

I see almost no conversations on that bot in the last 6 days except for two 404 errors.

  1. Was ngrok still running?
  2. Can you provide timestamps for the error?
  3. How is the bot being installed in Teams?
  4. Your manifest lacks the createCard and shareMessage commands, so that may cause an issue with using the sample code in your bot.
  5. That the handleTeamsMessagingExtensionSubmitAction isn’t even being reached, it leads me to believe something is off with your code. Can you get sample 51 to work, but itself? If so, there’s an issue with your code and you’ll need to link me to it so I can help debug it.
Read more comments on GitHub >

github_iconTop Results From Across the Web

MS Teams Task task modules from bots failing with 501 error
When user invoke task module using task/fetch , Bot calls handleTeamsTaskModuleFetch handler and respond with 501 because invokeResponse is ...
Read more >
Error 501 Not Implemented: how to fix it and main causes
Error 501 is a HyperText Transfer Protocol (HTTP) status code that stands for Not Implemented. This server error response code means that ...
Read more >
Messaging Extension SSO Config Bot - Code Samples
Bot Framework v4 sample for Teams to include a configuration page and Bot Service SSO authentication. Interaction with app. Prerequisites.
Read more >
Add a Message Extension - Teams app camp
Exercise 1: Bot registration. Message extensions allow users to bring the application into a conversation in Teams. You can search data in your...
Read more >
Mattermost API Reference
Use the error logs to help track down any remaining uses of API v3. ... For example, getting a channel by ID no...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found