Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 团队扩展thrwing未处理PromiseEjectionWarning错误:BotFrameworkAdapter.processActivity():501错误_Node.js_Botframework_Microsoft Teams - Fatal编程技术网

Node.js 团队扩展thrwing未处理PromiseEjectionWarning错误:BotFrameworkAdapter.processActivity():501错误

Node.js 团队扩展thrwing未处理PromiseEjectionWarning错误:BotFrameworkAdapter.processActivity():501错误,node.js,botframework,microsoft-teams,Node.js,Botframework,Microsoft Teams,我刚开始做团队扩展。我修改了微软提供的代码。我的舱单: ... "composeExtensions": [ { "botId": "[BOT ID HERE]", "canUpdateConfiguration": true, "commands": [ { "id": "createTimeDisplay&

我刚开始做团队扩展。我修改了微软提供的代码。我的舱单:

 ...
"composeExtensions": [
  {
    "botId": "[BOT ID HERE]",
    "canUpdateConfiguration": true,
    "commands": [
      {
        "id": "createTimeDisplay",
        "type": "action",
        "title": "createTimeDisplay",
        "description": "Creates a clock showing the given time in the users timezone.",
        "initialRun": true,
        "fetchTask": true,
        "context": [
          "commandBox",
          "compose",
          "message"
        ],
        "parameters": [
          {
            "name": "param",
            "title": "param",
            "description": ""
          }
        ],
        "taskInfo": {
          "title": "Create a new time display",
          "width": "medium",
          "height": "medium",
          "url": "[SOME NGROK PATH HERE]/newTimeDisplay"
        }
      }
    ]
  } ...
这是我的index.js:

//创建bot处理程序
const botActivityHandler=新的botActivityHandler();
const server=express();
const port=process.env.port | process.env.port | 3978;
server.post('/api/messages',(req,res)=>{
console.log(“发布到api/messages/”)
adapter.processActivity(请求、恢复、异步(上下文)=>{
console.log(“处理活动”)
//处理bot活动
等待botActivityHandler.run(上下文);
});
});
server.get('/api/messages',(req,res)=>{
log(“获取api/messages/”)
});
服务器。侦听(端口,()=>
console.log(`\Bot/ME服务正在侦听http://localhost:${port}`)
);
控制台日志(“测试”)
//侦听传入的请求。
还有我的botActivityHandler:


类BotActivityHandler扩展了TeamsActivityHandler{
构造函数(){
超级();
}
HandleteMessageExtensionSubmitation(上下文,操作){
开关(action.commandId){
案例“createTimeDisplay”:
返回createTimeDisplay(上下文、操作);
违约:
//返回createCardCommand(上下文、操作);
console.log(“此处”)
抛出新错误(“未实现”);
}
}
handleTeamsAppBasedLinkQuery(上下文,查询){
console.log(“look2”)
const attachment=CardFactory.thumbnailCard('缩略图卡',
query.url,
['https://raw.githubusercontent.com/microsoft/botframework-sdk/master/icon.png']);
常数结果={
附件布局:“列表”,
键入:“结果”,
附件:[附件]
};
常数响应={
composeExtension:结果
};
返回响应;
}
}
函数createTimeDisplay(上下文、操作){
log(“LOOK!!”)
console.log(上下文)
const heroCard=CardFactory.heroCard(“测试”,“我有文本”);
常量附件={contentType:heroCard.contentType,内容:heroCard.content,预览:heroCard};
返回{
组合扩展:{
键入:“结果”,
附件布局:“列表”,
附件:[
附件
]
}
};
}
module.exports.BotActivityHandler=BotActivityHandler;
当我在聊天中单击分机时,此代码会在控制台中显示此错误消息:

test
Bot/ME service listening at http://localhost:3978
Posted to api/messages/
processing Activity
(node:26072) UnhandledPromiseRejectionWarning: Error: BotFrameworkAdapter.processActivity(): 501 ERROR
    at BotFrameworkAdapter.<anonymous> (E:\dev\gitgarden\teamsTestApp\What is that in my timezone\node_modules\botbuilder\lib\botFrameworkAdapter.js:741:27)
    at Generator.next (<anonymous>)
    at fulfilled (E:\dev\gitgarden\teamsTestApp\What is that in my timezone\node_modules\botbuilder\lib\botFrameworkAdapter.js:12:58)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:26072) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise 
which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:26072) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero 
exit code.
测试
正在侦听的Bot/ME服务http://localhost:3978
已发布到api/消息/
加工活动
(节点:26072)未处理的PromisejectionWarning:错误:BotFrameworkAdapter.processActivity():501错误
在BotFrameworkAdapter上。(E:\dev\gitgarden\teamsTestApp\my timezone\node\u modules\botbuilder\lib\botFrameworkAdapter.js:741:27中是什么)
在Generator.next()处
完成时(E:\dev\gitgarden\teamsTestApp\my timezone\node\u modules\botbuilder\lib\botFrameworkAdapter.js:12:58中是什么)
在处理和拒绝时(内部/process/task_queues.js:93:5)
(使用`node--trace warnings…`显示警告的创建位置)
(节点:26072)未处理的PromisejectionWarning:未处理的承诺拒绝。此错误源于在没有catch块的情况下抛出异步函数内部,或者拒绝承诺
这不是用.catch()处理的。要在未处理的承诺拒绝时终止节点进程,请使用CLI标志“---unhandled rejections=strict”(请参阅https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (拒绝id:2)
(节点:26072)[DEP0018]弃用警告:未处理的承诺拒绝已弃用。将来,未处理的承诺拒绝将终止Node.js进程,其值为非零
退出代码。

我不知道怎么了。感谢任何帮助/想法。

你能试试这个@TheGreydiamond吗?你解决了错误吗?不,我放弃了这个项目,改做了其他事情。