Bot response coming twice in Skype channel
Bot responses are working fine in Direct line and web chat but for some reasons the response comes two times in Skype channel.
I have a for loop inside messagerecieveasync and sending responses within this loop. I see that messagerecievedasync is getting called twice.
Please let me know if anybody has seen this type of behaviour and any potential solutions.
If MessageReceivedAsync is being called twice, can you look at the IActivity passed to it and see whether it's the same IActivity?
@willportnoy @Kothakapu says that the same code works fine on DirectLine and WebChat. This is only happening on Skype channel.
@Kothakapu I don't know if it is helpful, but I had the same issue in WebChat. I've resolved it by upgrading from v1 to v3.
@Kothakapu Will you please share your bot msa app id and I will check in logs what was happening on the wire.
@konstlut Below is the Microsoft app id of bot for which I'm getting multiple responses "93f3d14a-6d80-44a0-83f8-1818a7d192b4"
@Kothakapu Thank you for providing the info. Messages are sent twice because for every message sent on the bot callback url, your bot returns 500, which is treated as transient failure and retried by backend. This is the error we see:
2017-01-23 10:05:22.5477 [LogErrorResponseBodyHandler] Response code: InternalServerError Body: {
"message": "An error has occurred.",
"exceptionMessage": "Type 'Microsoft.Bot.Connector.Activity' in Assembly 'Microsoft.Bot.Connector, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' is not marked as serializable.",
"exceptionType": "System.Runtime.Serialization.SerializationException",
"stackTrace": " at System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type)\r\n at System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context)\r\n at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo()\r\n at System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder)\r\n at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Wr
Closing as we have identified the issue. Please open a new issue if you want to discuss further.
When the client is using Skype on iOS, we are getting the client's message twice, from the Microsoft Bot to our microservice . This behavior doesn't happen when the user is using Skype on Windows.
We know that we are not returning any 500; therefore, the treated as transient failure hypothesis doesn't apply.
We have one hypothesis which is that MS Bot is waiting for sendTyping signal to be send immediately from our microservice for all messages. Since, MS bot isn't receiving the sendTyping right away, it timeout and resend the message. I know that this is unlikely but worth to try.
One solution to the problem (until the root cause if found and solved) would be to keep track of the time frame between messages received from MS Bot. If the message is the same and the time frame is very short, then we can ignore the second message. Similar way that button bouncing is solved in micro-controllers.
Were there any resolutions to this @acarlstein ? We are facing the same in a skype calling bot, where the callback method is being hit multiple times (max 3) randomly.
Any solution? I'm facing the same issue. My bot works fine on webchat but when I try it on Skype it returns the message plus a "Sorry, my bot code is having an issue" twice