简体   繁体   English

Microsoft Teams bot在模拟器和localhost上运行,但不是Teams App

[英]Microsoft Teams bot working from emulator and localhost but not teams app

I am trying to get a bot working in Microsoft Teams, hosted in azure, written in Node / Javascript. 我正在尝试让一个以Azure / Azure托管,以Node / Javascript编写的机器人在Microsoft Teams中工作。

To eliminate the issue being my code I am currently just trying to host one of the microsoft sample bots... https://github.com/microsoft/BotBuilder-Samples/tree/master/samples/javascript_nodejs/07.using-adaptive-cards 为了消除作为我的代码的问题,我目前正试图托管一个Microsoft示例机器人... https://github.com/microsoft/BotBuilder-Samples/tree/master/samples/javascript_nodejs/07.using-adaptive -牌

I'm finding the bot is working on localhost. 我发现该机器人正在localhost上运行。 It also working through NGROK and if I use the bot emulator and load the bot from azure at endpoint... https://cnbeaconbot.azurewebsites.net/api/messages This works too. 它还可以通过NGROK进行工作,如果我使用机器人模拟器并从终端的azure加载机器人,那么它也可以通过https://cnbeaconbot.azurewebsites.net/api/messages进行操作

What isn't working is when I add the bot to my MS Teams app through the app studio application. 当我通过应用程序工作室应用程序将漫游器添加到MS Teams应用程序时,什么都行不通。 Initially to get a demo working I haven't added secrets / passwords or authentication to my bot at this point. 最初,为了使演示工作正常,我现在还没有向我的机器人添加机密/密码或身份验证。 I'm looking to set up the simplest possible demo that I can build from. 我正在寻找一个可以建立的最简单的演示。

I havent made any customisations to the MS sample, the code for can be found here... https://github.com/microsoft/BotBuilder-Samples/tree/master/samples/javascript_nodejs/07.using-adaptive-cards 我尚未对MS示例进行任何自定义,可在此处找到其代码... https://github.com/microsoft/BotBuilder-Samples/tree/master/samples/javascript_nodejs/07.using-adaptive-cards

In the bot service console in Azure, within the Test in Web chat channel I have an error "There was an error sending this message to your bot: HTTP status code Unauthorized" 在Azure的bot服务控制台中,在Web聊天通道中的测试中,出现错误“将此消息发送到您的bot时出错:HTTP状态码未授权”

But no errors have been logged within my Teams channel. 但是我的团队频道中没有记录任何错误。 I've checked the endpoints, they all match what I'm using in Bot emulator and I'm not sure what else to check. 我已经检查了端点,它们都与我在Bot仿真器中使用的端点匹配,并且我不确定还要检查什么。

In teams when I summon my bot with the @mention it doesn't respond as expected. 在团队中,当我用@mention召唤我的机器人时,它没有按预期响应。 There is no response from the bot at all. 该机器人完全没有响应。

I've using Teams web app in chrome along with fiddler hoping it would return a HTTP error, 404, 500 but there's nothing outputting there. 我在chrome中使用了Teams网络应用程序,并与提琴手一起希望它会返回HTTP错误404、500,但那里没有任何输出。

If anyone has deployed an azure app in node and using Teams App Studio I'd appreciate any insights. 如果有人在节点中部署了Azure应用程序并使用Teams App Studio,我将不胜感激。

Thanks in advance :) Andy 在此先感谢:)安迪

Got some more info, here's what the test in Web Chat is returning 有更多信息,这是Web Chat中的测试返回的内容

Utj-TW1baCBV.js:9 [Microsoft_Azure_BotService]  1:01:13 PM 
MsPortalFx.Base.Diagnostics.ErrorReporter 1         
MsPortalFx.Base.Diagnostics.ErrorReporter: _errorData: undefined
_sourceErrorLevel: undefined
baseTypes: ["MsPortalFx.Errors.AjaxError","MsPortalFx.Errors.Error"]
code: undefined
data {"uri":"https://botservice.hosting.portal.azure.net/botservice/api/ClientTrace","type":"POST","pathAndQuery":"","requestId":"5738e762-2aa1-4640-b086-495936e70007","failureCause":"","sessionId":"40a3f6eb3b284c5fa66db8b8fe21a06a","status":404,"statusText":"error","duration":47.82500024884939}
errorLevel: 2
errorThrown: 
extension: Microsoft_Azure_BotService
handled: undefined
innerErrors: []
jqXHR: {"readyState":4,"responseText":"Not 
Found","status":404,"statusText":"error"}
message: ajaxExtended call failed
name: Error
source: undefined
stack: null
textStatus: error
timestamp: 80466.26000013202
type: MsPortalFx.Errors.AjaxError https://webchat.botframework.com/v3/directline/conversations/8hFWddDOnZm5fuIih3b4Sz-a/activities 502

and also... 并且...

b2bn3_EAuRkB.js:19 POST https://botservice.hosting.portal.azure.net/botservice/api/ClientTrace 404

Seem to mention both a 502 and 404 there so'll I'll post more info if I find anything out. 似乎在这里同时提到502和404,所以如果发现任何问题,我将发布更多信息。

I decided to start from scratch but this time I created my bot from the Web App Bot . 我决定从头开始,但是这次我是从Web App Bot创建我的机器人的。 creator in azure. 天蓝色的创作者。 Previously I'd been building the bot as a Azure hosted web app and registering it. 以前,我曾将该机器人构建为Azure托管的Web应用程序并进行了注册。 The bot template I used was Echo Bot. 我使用的Bot模板是Echo Bot。

Initially nothing was working until I downloaded the code. 最初,在我下载代码之前,一切都没有进行。 I didn't change anything I just wanted to have look at it. 我没有改变任何我只想看看的东西。 I decided to redeploy the same code using the VS Code Azure extension . 我决定使用VS Code Azure扩展重新部署相同的代码。

This now appears to be working in Emulator, localhost and a Teams app created in app studio. 现在,这似乎可以在Emulator,localhost和在App Studio中创建的Teams应用程序中使用。

Something I hadn't done in my effort described above was use a appId and PW/Secret to secure the app. 我在上述工作中没有做过的事情是使用appId和PW / Secret来保护应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM