AdaptiveCards icon indicating copy to clipboard operation
AdaptiveCards copied to clipboard

AdaptiveCard on Slack: Image with no content

Open hrlourenco opened this issue 9 years ago • 12 comments

Version Bot: 3.8.1 Channels: Slack and Web

Issue Description

We are using AdaptiveCards. Until last week we have this working in both channels, even in slack the adptive card appear as an image while web mode appears in text (as it is supposed to be).

Since this week, slack adptive card is not working, whenever we make a request to show the card it appears the space of the image, the image exists but no content.

This is 2 image examples: https://bcattachmentsprod.blob.core.windows.net/at13023/BiQrsQYenEx-original https://slack-imgs.com/?c=1&url=https://bcattachmentsprod.blob.core.windows.net/at13023/JTJAU9ye6Q7-original

This works on web channel, the content is correct,

Code Example

//FactSet string title = $"{TicketNumber} - {Title}";

List<AdaptiveCards.Fact> lstFacts = new List<AdaptiveCards.Fact>() { new AdaptiveCards.Fact("Ticket Nr", TicketNumber), new AdaptiveCards.Fact("Team", ResponsibleTeam), new AdaptiveCards.Fact("Status", Status), };

List listaCards = new List() { UX.AdCards.ContainerFactSet.CreateFactSetWithTitle(ticket.Title, TextColor.Attention, lstFacts), UX.AdCards.ContainerDescription.CreateDescription("Description", InitialDescription), };

List listAction = new List(); OpenUrlAction o = new OpenUrlAction() { Title = "Show", Url = ticket.GetLink() }; listAction.Add(o);

var card = new AdaptiveCard() { Body = listaCards, Actions = listAction, Title = title };

//Attachements Attachment attachment = new Attachment() { ContentType = AdaptiveCard.ContentType, Content = card };

var reply = context.MakeMessage(); reply.Attachments.Add(attachment);

return reply;

public static Container CreateDescription(string title, string description, int maxDescriptionSize = 256000, bool removeHTMLImages = true) { //remove images if some appears in text string descriptionAux = description; if (removeHTMLImages) { Regex regex = new Regex(@"<img(.*?)/>"); descriptionAux = regex.Replace(descriptionAux, "##Removed Image##"); }

int val = System.Text.ASCIIEncoding.Unicode.GetByteCount(descriptionAux);

if (val > maxDescriptionSize)
{
	descriptionAux = new string(descriptionAux.Take(100).ToArray()) + "... [Texto removido devido ao extenso tamanho]";
}


var converter = new ReverseMarkdown.Converter();
description = converter.Convert(descriptionAux);

Container container = new Container();
if (!string.IsNullOrEmpty(description))
{
	container.Items = new List<CardElement>()
	{
				new TextBlock()
				{
					Color = TextColor.Dark,
					Weight = TextWeight.Bolder,
					Text = title,
					Wrap = true
				},
				new TextBlock()
				{
					Color = TextColor.Default,
					Weight = TextWeight.Lighter,
					Text = description,
					Wrap = true
				}
	};
}
return container;

}

Reproduction Steps

1.Go to slack 2.Request to show a card

Expected Behavior

Appears the card. Slack: Show card (as an image for now, if possible should appear as text, but not full support yet by microsoft) Web: Show card

Actual Results

The image on Slack appears with no content, full transparent.

UPDATE

I'm receiving the below error in appinsights, and it seems to be related to my issue:

POST to XXX_ASH failed: POST to the bot's endpoint failed with HTTP status 500POST to the bot's endpoint failed with HTTP status 500

Microsoft.Bot.Schema.BotException:
   at Microsoft.Bot.ChannelConnector.BotAPI+<PostActivityToBotAsync>d__29.MoveNext (Microsoft.Bot.ChannelConnector, Version=3.2.0.0, Culture=neutral, PublicKeyToken=null: d:\a\1\s\ChannelSDK\Microsoft.Bot.ChannelConnector\API\BotAPI.cs: 312)
Inner exception System.Exception handled at Microsoft.Bot.ChannelConnector.BotAPI+<PostActivityToBotAsync>d__29.MoveNext:
   at Microsoft.Bot.ChannelConnector.BotAPI+<PostActivityToBotAsync>d__29.MoveNext (Microsoft.Bot.ChannelConnector, Version=3.2.0.0, Culture=neutral, PublicKeyToken=null: d:\a\1\s\ChannelSDK\Microsoft.Bot.ChannelConnector\API\BotAPI.cs: 308)
assembly Microsoft.Bot.ChannelConnector, Version=3.2.0.0, Culture=neutral, PublicKeyToken=null
  method Microsoft.Bot.ChannelConnector.BotAPI+d__29.MoveNext
  level 0
  line 312
  fileName d:\a\1\s\ChannelSDK\Microsoft.Bot.ChannelConnector\API\BotAPI.cs

hrlourenco avatar Nov 24 '17 15:11 hrlourenco

I've responded to the duplicate post on the BotBuilder repo: https://github.com/Microsoft/BotBuilder/issues/3823

EricDahlvang avatar Nov 24 '17 22:11 EricDahlvang

So I've done a lot of digging here and I think I found what's going on: https://support.microsoft.com/en-us/help/4043601/rendering-issues-after-the-september-12-2017-net-security-and-quality

A September security rollout broke the scenario of using WPF in a service, which is why we're seeing blank images on occasion.

There are 4 October patches that should fix the issue but we'll have to wait for azure to roll them out. The problem should then resolve itself and the image rendering service will continue working as expected.

I'll keep you posted as we learn more. Sorry about the troubles!

matthidinger avatar Nov 30 '17 19:11 matthidinger

@matthidinger Was so issue solved meanwhile? It seems to be back now.

Using Bot Builder and Bot Connector packages v3.12.2.4 and AdaptiveCards package v1.0.0-beta10. Was working a couple of days ago with Bot Builder, Bot Connector v3.11 and AdaptiveCards v1.0.0-beta8.

robinsedlaczek avatar Nov 30 '17 23:11 robinsedlaczek

I can confirm it's back, in node.js

ejadib avatar Dec 01 '17 14:12 ejadib

We're still managing the rollout and patching, so you may continue to see sporadic failures. Will keep this thread posted as I learn more

matthidinger avatar Dec 01 '17 19:12 matthidinger

Thanks @matthidinger. This is affecting one of bots soon to go live and it started to happen today and it was kind of a surprise until we found this thread. We will keep an eye on this post

ejadib avatar Dec 01 '17 19:12 ejadib

This is happening to me as well. AdaptiveCards are rendered as an empty image in facebook messenger. I'm using BotFramework for .NET.

xjose97x avatar Dec 02 '17 23:12 xjose97x

@matthidinger do you have an ETA on this?

ejadib avatar Dec 04 '17 13:12 ejadib

When will this solve the problem? I am currently using an adaptive card, but I can not solve it.

I have changed botbuilder 3.12.2.4, adaptivecard 1.0.0-beta10 due to a problem with botbuilder 3.8.1, adaptivecard 0.5.1, but there is still a problem.

Skype works normally, but facebook does not work.

khs3141 avatar Dec 04 '17 23:12 khs3141

It seems this is working again. @matthidinger can you confirm?

ejadib avatar Dec 05 '17 19:12 ejadib

Hi folks, we've patched all of the servers and this should be working as expected now. Please re-open if you're see any issues. We apologize for any downtime this has caused you!

matthidinger avatar Dec 05 '17 21:12 matthidinger

Sorry, I have to reopen. #1038

robinsedlaczek avatar Dec 11 '17 05:12 robinsedlaczek