馃毃 The issue tracker is not for questions 馃毃
If you have a question, please ask it on https://stackoverflow.com/questions/tagged/botframework
[question]
I'm implementing sample #54 Teams Task Module as a skill as shown in sample 80.skills-simple-bot-to-bot. I'm using the simple-root-bot in sample 80 to consume the Teams Task Module skill. When I install the root bot app in teams I get this error

I have deployed the skill directly to teams (same code, same App ID) and it works, the problem seems to be when the bot is consumed by another bot as a skill. I have tried both the adaptive card task module and the HTML iframe task module to test whether it could be a problem with "ValidDomains" but it doesn't seem to be because both task modules show the same error.
If there's an error on Teams, there'll be a matching error somewhere in your code. Can you post the error your code is kicking out? In the meantime, I'll try to repro this, see what's going on.
Hi @jwiley84 this is the error code I get:
`2020-08-05T19:26:28.301Z Err Unhandled exception. Error: Unable to reach app. Please try again., cause: , stack: new t@https://statics.teams.cdn.office.net/hashedjs/3.2-app.min-7699799.js:3:201585 > {anonymous}()@https://statics.teams.cdn.office.net/hashedjs/3.2-app.min-7699799.js:3:207762 > f@https://statics.teams.cdn.office.net/hashedjs/0-angular-jquery.min-eee9041.js:127:115 > {anonymous}()@https://statics.teams.cdn.office.net/hashedjs/0-angular-jquery.min-eee9041.js:127:345 > {anonymous}() (m.)$eval@https://statics.teams.cdn.office...
2020-08-05T19:26:28.300Z Err Unhandled exception. : , cause: , stack: {anonymous}(#object,null) > printStackTrace(#object)
2020-08-05T19:26:28.300Z War HTTP request DM invoke POST failed: POST "https://amer.ng.msg.teams.microsoft.com/v1/agents/28:36e77a87-99f8-4605-b466-1a0cfa838d18/invoke", status: 502, response: {"errorCode":1008,"message":"
2020-08-05T19:26:27.402Z War Analytics service: Panel data not present to populate panel action, falling back to main`
Perfect. Let me dig into that and see what's coming up. Usually 502s on Teams based bots mean something is funny with the manifest.json. It might be that the skill needs it's own manifest.json.
Hi @MariaMendietaSpur Just wanted to let you know I haven't forgotten this issue. I'm having some difficulty getting the two (root and skill) to connect. I'm still working on this.
@MariaMendietaSpur Can you post your task module bot file? (ie TeamsTaskModule.cs or TeamsTaskModule.js)
@jwiley84 we made it work. Not sure exactly what was the problem, we started over and tried different things and it worked.
`// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using AdaptiveCards;
using Microsoft.Bot.Builder;
using Microsoft.Bot.Builder.Teams;
using Microsoft.Bot.Schema;
using Microsoft.Bot.Schema.Teams;
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Microsoft.BotBuilderSamples.Models;
namespace Microsoft.BotBuilderSamples.Bots
{
public class TeamsTaskModuleBot : TeamsActivityHandler
{
private readonly string _baseUrl;
public TeamsTaskModuleBot(IConfiguration config)
{
_baseUrl = config["BaseUrl"];
}
protected override async Task OnMessageActivityAsync(ITurnContext<IMessageActivity> turnContext, CancellationToken cancellationToken)
{
var reply = MessageFactory.Attachment(new[] { GetTaskModuleAdaptiveCardOptions() });
await turnContext.SendActivityAsync(reply, cancellationToken);
}
protected override Task<TaskModuleResponse> OnTeamsTaskModuleFetchAsync(ITurnContext<IInvokeActivity> turnContext, TaskModuleRequest taskModuleRequest, CancellationToken cancellationToken)
{
var asJobject = JObject.FromObject(taskModuleRequest.Data);
var value = asJobject.ToObject<CardTaskFetchValue<string>>()?.Data;
var taskInfo = new TaskModuleTaskInfo();
//taskInfo.Url = taskInfo.FallbackUrl = _baseUrl + "/" + TaskModuleIds.UploadDoc;
// SetTaskInfo(taskInfo, TaskModuleUIConstants.UploadDoc);
//ADDING CARD
switch (value)
{
case TaskModuleIds.YouTube:
taskInfo.Url = taskInfo.FallbackUrl = _baseUrl + "/" + TaskModuleIds.YouTube;
SetTaskInfo(taskInfo, TaskModuleUIConstants.YouTube);
break;
case TaskModuleIds.UploadDoc:
taskInfo.Url = taskInfo.FallbackUrl = _baseUrl + "/" + TaskModuleIds.UploadDoc;
SetTaskInfo(taskInfo, TaskModuleUIConstants.UploadDoc);
break;
case TaskModuleIds.AdaptiveCard:
taskInfo.Card = CreateAdaptiveCardAttachment();
SetTaskInfo(taskInfo, TaskModuleUIConstants.AdaptiveCard);
break;
default:
break;
}
return Task.FromResult(taskInfo.ToTaskModuleResponse());
}
protected override Task OnEndOfConversationActivityAsync(ITurnContext<IEndOfConversationActivity> turnContext, CancellationToken cancellationToken)
{
// This will be called if the root bot is ending the conversation. Sending additional messages should be
// avoided as the conversation may have been deleted.
// Perform cleanup of resources if needed.
return Task.CompletedTask;
}
protected override async Task<TaskModuleResponse> OnTeamsTaskModuleSubmitAsync(ITurnContext<IInvokeActivity> turnContext, TaskModuleRequest taskModuleRequest, CancellationToken cancellationToken)
{
var reply = MessageFactory.Text("OnTeamsTaskModuleSubmitAsync Value: " + JsonConvert.SerializeObject(taskModuleRequest));
await turnContext.SendActivityAsync(reply, cancellationToken);
return TaskModuleResponseFactory.CreateResponse("Thanks!");
}
private static void SetTaskInfo(TaskModuleTaskInfo taskInfo, UISettings uIConstants)
{
taskInfo.Height = uIConstants.Height;
taskInfo.Width = uIConstants.Width;
taskInfo.Title = uIConstants.Title.ToString();
}
private static Attachment GetTaskModuleAdaptiveCardOptions()
{
// Create an Adaptive Card with an AdaptiveSubmitAction for each Task Module
var card = new AdaptiveCard(new AdaptiveSchemaVersion(1, 2))
{
Body = new List<AdaptiveElement>()
{
new AdaptiveTextBlock(){ Text="Upload Document from Adaptive Cardio", Weight=AdaptiveTextWeight.Bolder, Size=AdaptiveTextSize.Large}
},
//Actions = new[] { TaskModuleUIConstants.UploadDoc}
//ADDING CARD
Actions = new[] { TaskModuleUIConstants.AdaptiveCard, TaskModuleUIConstants.UploadDoc, TaskModuleUIConstants.YouTube }
.Select(cardType => new AdaptiveSubmitAction() { Title = cardType.ButtonTitle, Data = new AdaptiveCardTaskFetchValue<string>() { Data = cardType.Id } })
.ToList<AdaptiveAction>(),
};
return new Attachment() { ContentType = AdaptiveCard.ContentType, Content = card };
}
private static Attachment CreateAdaptiveCardAttachment()
{
// combine path for cross platform support
string[] paths = { ".", "Resources", "adaptiveCard.json" };
var adaptiveCardJson = File.ReadAllText(Path.Combine(paths));
var adaptiveCardAttachment = new Attachment()
{
ContentType = "application/vnd.microsoft.card.adaptive",
Content = JsonConvert.DeserializeObject(adaptiveCardJson),
};
return adaptiveCardAttachment;
}
}
} `
I'm very glad you got it to work! Thank you for the update. I'm going to keep this open until I can repro the issue and then solve it, so that future devs can learn from the knowledge.
Most helpful comment
Perfect. Let me dig into that and see what's coming up. Usually 502s on Teams based bots mean something is funny with the manifest.json. It might be that the skill needs it's own manifest.json.