Open MajaEffenberg opened 2 years ago
Hi MajaEffenberg! Thank you for bringing this issue to our attention. We will investigate and if we require further information we will reach out in one business day. Please use this link to escalate if you don't get replies.
Best regards, Teams Platform
Could you please share the repro steps and the sample if you are referring to any?
Updating the adaptation card in steps:
replyMessageId
from TurnContext.activity.replyMessageId
CardFactory.adaptiveCard()
attachmentActivity
using MessageFactory.attachment()
with this new adaptive cardid
we add in attachmentActivity
the previously read replyMessageId
attachmentActivity.id = replyMessageId
TurnContext.updateActivity(attachmentActivity)
Such a flow of updating AdaptiveCards works most of the time. The error appears randomly around every 1000 updated cards.
Is there any update on this issue?
We are checking this, I will share an update soon.
@MajaEffenberg - We looped the above scenario for 1900 and 3000 cards and it worked fine. The cards got updated successfully and we did not get any error. Could you please share any other specific details so that we can have a local repro of this?
@MajaEffenberg - We looped the above scenario for 1900 and 3000 cards and it worked fine. The cards got updated successfully and we did not get any error. Could you please share any other specific details so that we can have a local repro of this?
Hi, I'm a coworker of @MajaEffenberg. We tried to analyze the problem more in detail. The error appears in different scenarios. Here a specific one. Have a look at our log messages:
Comments to the logs: It appears that a user clicks twice on the same button (which is usually not possible, since the button is blocked after clicking it once). We can see that both messages have the same TurnContext.activity.value and they arrived on the server inbetween a couple of milliseconds. We have no idea how this scenario can be reproduced. How is it possible, that someone clicks twice on a button inbetween a couple of milliseconds?
After that strange behaviour also our two update calls fail with the error message:{"error":{"code":"ActivityNotFoundInConversation","message":"Message does not exist in the thread."}}. However you can see, that the ids are the same.
There is definitely something buggy...
Thanks for sharing the logs. We will take a look at it.
@sueess, @MajaEffenberg - Engineering team is checking the logs provided. Could you please help answering the below questions?
(1) is the time given in the log UTC time?
(2) Is your bot id 4112cc9a-d683-4ffd-b0bc-2013af7c7497
?
(3) Does this issue happen in bot:user chat only?
How is it possible, that someone clicks twice on a button inbetween a couple of milliseconds? ==> Assuming it is the issue happening between a user and a bot, it is possible that a human user double clicks the button instead of a single click when one interacts with the adaptive card using their mouse.
@Meghana-MSFT
(1) Yes it is UTC time (2) Yes, correct (3) If by bot:user you mean personal scope of bot, then yes, because we only support personal scope (no group or teams chats)
How is it possible, that someone clicks twice on a button inbetween a couple of milliseconds? ==> Assuming it is the issue happening between a user and a bot, it is possible that a human user double clicks the button instead of a single click when one interacts with the adaptive card using their mouse.
We tried to do that many times, but we could not reproduce it. The button is blocked right after the first click (which is good!). If you know how to do that, let us know, so we can check again.
We get the error every day a couple of times. In case you need our support, feel free to organize an call. Thanks for your effort!
@sueess - Could you please help by sharing the video recording of the above mentioned issue, as we do not have a local repro of the same.
@Meghana-MSFT We cannot reproduce that problem ourself. We do not know how it happens. But also, what do you expect to see on that video? --> The card will not be updated.
We get everyday multiple errors on that. We see that in our logs and also in the Azure logs. But as mentioned before, it works 1000 times an maybe one time it does not. So it must be an internal Microsoft Teams problem.
The ActivityNotFoundInConversation
error reappears in our application when updating adaptive card in MS Teams using TurnContext.updateActivity()
.
Request information:
5.7.2022 - 19:35:42
PUT
https://smba.trafficmanager.net/ch/v3/conversations/a%3A1327NzSadROxCgrZ8mluixnj91RNiHXSIC4n3J9RBldbIrXUkL65m9Y1deNLwbc3VjYwNDH8SMw6L-ezEASGvlraSCdKWW-TwnstntaUI8EWPgQiNFSi2YxzkC4RQ-_fb/activities/1657049692780
a:1327NzSadROxCgrZ8mluixnj91RNiHXSIC4n3J9RBldbIrXUkL65m9Y1deNLwbc3VjYwNDH8SMw6L-ezEASGvlraSCdKWW-TwnstntaUI8EWPgQiNFSi2YxzkC4RQ-_fb
1657049692780
Our botId: 4112cc9a-d683-4ffd-b0bc-2013af7c7497
@MajaEffenberg - Thanks for the additional information. Team is looking into the issue.
@MajaEffenberg - Please find the Engineering teams findings -
On the Teams Backend service side, we do not see the two messages that are mentioned in the log in the database. As such, when the bot tries to update those messages, the bot gets errors saying "no message found".
Teams Engineering team is trying to understand why those messages do not exist in the database as it seems the bot sent those messages from user's perspective.
Based on this data, Engineering team needs some more information. Could you please help us to identify when the bot sent these messages that failed to be updated (1657049372481 & 1657049692780) in the logs?
@Meghana-MSFT Thanks for the information.
Timestamps in UTC when the bot sent these messages are:
5.7.2022 - 19:25:19
5.7.2022 - 19:30:46
Is there any update on this issue?
@MajaEffenberg - Engineering team has been investigating the logs and has the below understanding of the scenario. Pasting below the observations made by the team. Could you please confirm if the understanding of bot scenario is correct?
Details: Per the understanding, this is the customer's bot scenario -
In the (1) step, when the bot calls SendActivity, the API returns message id as a response. This is the id of the adaptive card. This id needs to be the same as replyToid in the invoke request in (3) step.
But for 1657049372481
& 1657049692780
case, this is not true.
For instance, the customer says that their bot sent 1657049372481
in 07-05-2022 19:25:19 in UTC. When I checked the log, the response id of this send Activity was 165704911967. This means the id of the adaptive card that the bot tried to update is 165704911967
, not 1657049372481
AFAIK, replyToId in invoke request is stamped by the Teams Client. It is possible that a user's Teams Client somehow stamps an invalid message id due to a race condition.
@Meghana-MSFT Thanks for the information.
Yes, your descriptions in the points about customer bot scenario are correct.
We based our adaptive card updates on the Teams documentation, where it says "To update the existing card on button selection, you can use ReplyToId of incoming activity." For this reason we use ReplyToId
to update the adaptive card, not the id
we get from response after sending SendActivity.
Two days ago this bug appears again and we were able to logged response message from Send Activity which includes message id:
17.7.2022 - 21:23:34
(UTC) using SendActivity. As a response we got message id: 1658093014281
17.7.2022 - 21:31:31
(UTC) with replyToId 1658093446508
and uses this id to update the adaptive card. Unfortunately he gets an error during the update:
{
"error": {
"code": "ActivityNotFoundInConversation",
"message": "Message does not exist in the thread."
}
}
As you can see above, the id
of the message we received in response after sending this message is different than the id we received in replyToId
. And the user clicked the button exactly in this adaptive card we sent earlier and the response id after sending was 1658093014281
.
Thank you for confirming. While the engineering team is investigating deeper into this, please note that
(1) The bot gets the exception as it is somehow getting an invalid message id from the invoke request, and therefore the bot is trying to update the messages that do not exist and
(2) Teams engineering team is currently investigating why an invalid message id is coming to the backend from the begin with.
Any news on this issue?
The team is still investigating the issue. We will keep you posted on the updates.
@Meghana-MSFT We again have multiple occurrences of this issue. We are randomly not able to update activities. As you can imagine, this will always lead to a terrible user experience.
Is there any update on this? Do you need any further information from us?
@sschoeb - Could you please let us know if you are facing this issue in Teams classic or new Teams 2.1?
@sschoeb - Could you please let us know if you are facing this issue in Teams classic or new Teams 2.1?
@Meghana-MSFT Sorry, somehow I missed the first notification. I cannot say which Teams Client we have, we just get the exception back when trying to update the Activity. Is there any way I could get this information?
@sschoeb - Can you please share your Teams version with us? If the toggle button Try new Teams button is turned means you are using new Teams 2.1 else its Teams Classic.
@Meghana-MSFT Thanks for your reply. Sorry, didn't expect that you want to know my teams version. I'm using the new Teams. But I'm quite sure that this issue is not related to my personal teams, as I cannot reproduce (and was never able to, in the old and the new teams) this issue locally. This happens randomly in our bot for any customer uf us. Therefore I cannot answer your questions on which Teams-Versions the issue happens, as I cannot know that. The only thing I have is this "ActivityNotFoundInConversation"-Exception I get back when we try to update an activity.
Let me know if I can provide you with any further information, but I think @MajaEffenberg did already a very good analysis of the problem.
Thank you, we will share this with engineering team.
@Meghana-MSFT The engineering team is investigating since August 2022. And we still have this issue?
This kind of issues does randomly destroy the user experience of a bot conversation within teams and therefore also the user experience of teams itself. I hope this does raise the priority of the issue as it seems there is currently no priority at all :/
Hi there,
We got unusual errors from time to time when updating adaptive card in MS Teams:
We always read replyToId from TurnContext activity, and pass the same Id when we updating messages. In most cases, updating adaptive cards works, but it looks like errors appear randomly around every 1000 adaptive cards. And they appear for different users and adaptive cards. We also don't see any option for the user to be able to remove the card to be updated.
So we would like to know when and why this error may appear?