botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

[.NET SDK] 401 Unauthorized in 3.15.2.2

Open JasonSowers opened this issue 8 years ago • 57 comments

Bot Info

  • SDK Platform: .Net
  • SDK Version: 3.15.2.2

If you are experiencing this issue please post the following details, do not just post "Me too" with no details

  1. Frequency - How often is this happening? Every message? Randomly and how often ex. 1 out of 10 messages
  2. What channels is this happening on, is it working on any channels?
  3. Stack trace
  4. Deployment where is this happening - Local testing? Azure? Both?

if not locally 5. Type of bot Functions bot? Web App bot? 6. Is there any relevant info in app insights? 7. Timestamp and conversation ID when this occurs?

  1. Is the bot using the default state service? What state store is the bot using?

JasonSowers avatar Jun 12 '18 18:06 JasonSowers

Frequency - Every 2-3 hrs. What channels is this happening on, is it working on any channels? -> We are available only on teams and it's happening on teams.

Stack trace -> unauthorized_stacktrace.txt

Deployment where is this happening - Azure

  1. Type of bot Functions bot? Web App bot? -> Web App Bot [Microsoft App Id : 094e061b-7682-4bdd-8524-d35359dfcf67]
  2. Is there any relevant info in app insights? -> Looks like it happened while executing Conversation.SendAsync
  3. Timestamp and conversation ID when this occurs? 6‎/‎12‎/‎2018‎ ‎2‎:‎23‎:‎49‎ ‎PM and a:1TYwQEwOlQGyKFSLEamY_DS-bsmtgzZ_YhoIMPRyaBZvKufM1YHUrkj1LtMPGJvwfsEF9gmO4BkEGP70XFmKy5Y-o60Oe5W6bSMHHrfz3KxYOYTqYai0rjPUeV1tX6ILD

ujwalakhaire avatar Jun 12 '18 22:06 ujwalakhaire

  1. 2-3 hours and only one message, following messages would be processed without any issues, can appears in background job logs (perform connector.Conversations.SendToConversation((Activity)message);).
  2. Telegram Group Chat
  3. StackTrace.txt
  4. Azure
  5. Web App (Actualy don't understand this question)
  6. Disabled right now
  7. 2018-06-12 12:57:38.4186 and -230902953

prorok-kane avatar Jun 13 '18 05:06 prorok-kane

Every 2-5 hours, the first message Webchat, Facebook at Microsoft.Bot.Connector.Conversations.d__9.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Connector.ConversationsExtensions.d__9.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Dialogs.Internals.AlwaysSendDirect_BotToUser.d__4.MoveNext() in D:\a\1\s\CSharp\Library\Microsoft.Bot.Builder\ConnectorEx\BotToUser.cs:line 124\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Dialogs.Internals.InputHintQueue.d__4.MoveNext() in D:\a\1\s\CSharp\Library\Microsoft.Bot.Builder\ConnectorEx\BotToUser.cs:line 184\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Dialogs.Internals.AutoInputHint_BotToUser.d__3.MoveNext() in D:\a\1\s\CSharp\Library\Microsoft.Bot.Builder\ConnectorEx\BotToUser.cs:line 146\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Dialogs.Internals.MapToChannelData_BotToUser.d__3.MoveNext() in D:\a\1\s\CSharp\Library\Microsoft.Bot.Builder\ConnectorEx\BotToUser.cs:line 295\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Dialogs.Internals.LogBotToUser.d__4.MoveNext() in D:\a\1\s\CSharp\Library\Microsoft.Bot.Builder\ConnectorEx\IActivityLogger.cs:line 131\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Dialogs.Internals.DialogContext.d__12.MoveNext() in D:\a\1\s\CSharp\Library\Microsoft.Bot.Builder\Dialogs\DialogContext.cs:line 87\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Dialogs.Extensions.d__14.MoveNext() in D:\a\1\s\CSharp\Library\Microsoft.Bot.Builder\Dialogs\IDialogContext.cs:line 150\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Sample.SimpleEchoBot.EchoDialog.d__2.MoveNext() in C:\SW\dotnet\projects\arcofel Messenger\ArcofelMessengerBot-src\Dialogs\EchoDialog.cs:line 38\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Dialogs.Internals.DialogTask.ThunkResume1.d__5.MoveNext() in D:\a\1\s\CSharp\Library\Microsoft.Bot.Builder\Dialogs\DialogTask.cs:line 164\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Internals.Fibers.Wait2.d__19.MoveNext() in D:\a\1\s\CSharp\Library\Microsoft.Bot.Builder\Fibers\Wait.cs:line 0\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Internals.Fibers.Frame1.<Microsoft-Bot-Builder-Internals-Fibers-IFrameLoop-PollAsync>d__9.MoveNext() in D:\a\1\s\CSharp\Library\Microsoft.Bot.Builder\Fibers\Fiber.cs:line 0\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Internals.Fibers.Fiber1.d__16.MoveNext() in D:\a\1\s\CSharp\Library\Microsoft.Bot.Builder\Fibers\Fiber.cs:line 0\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at Microsoft.Bot.Builder.Internals.Fibers.Wait2.Microsoft.Bot.Builder.Internals.Fibers.IAwaiter.GetResult() in D:\a\1\s\CSharp\Library\Microsoft.Bot.Builder\Fibers\Wait.cs:line 378\r\n at Microsoft.Bot.Builder.Dialogs.Chain.LoopDialog1.d__3.MoveNext() in D:\a\1\s\CSharp\Library\Microsoft.Bot.Builder\Dialogs\Chain.cs:line 752\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Dialogs.Internals.DialogTask.ThunkResume1.d__5.MoveNext() in D:\a\1\s\CSharp\Library\Microsoft.Bot.Builder\Dialogs\DialogTask.cs:line 164\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Internals.Fibers.Wait2.d__19.MoveNext() in D:\a\1\s\CSharp\Library\Microsoft.Bot.Builder\Fibers\Wait.cs:line 0\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Internals.Fibers.Frame1.<Microsoft-Bot-Builder-Internals-Fibers-IFrameLoop-PollAsync>d__9.MoveNext() in D:\a\1\s\CSharp\Library\Microsoft.Bot.Builder\Fibers\Fiber.cs:line 0\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Internals.Fibers.Fiber1.d__16.MoveNext() in D:\a\1\s\CSharp\Library\Microsoft.Bot.Builder\Fibers\Fiber.cs:line 244\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Dialogs.Internals.DialogTask.d__23.MoveNext() in D:\a\1\s\CSharp\Library\Microsoft.Bot.Builder\Dialogs\DialogTask.cs:line 321\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Dialogs.Internals.ReactiveDialogTask.d__3.MoveNext() in D:\a\1\s\CSharp\Library\Microsoft.Bot.Builder\Dialogs\DialogTask.cs:line 376\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Dialogs.Internals.ScoringEventLoop`1.d__5.MoveNext() in D:\a\1\s\CSharp\Library\Microsoft.Bot.Builder\Dialogs\ScoringEventLoop.cs:line 87\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Dialogs.Internals.EventLoopDialogTask.d__3.MoveNext() in D:\a\1\s\CSharp\Library\Microsoft.Bot.Builder\Dialogs\DialogTask.cs:line 435\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Dialogs.Internals.SetAmbientThreadCulture.d__3.MoveNext() in D:\a\1\s\CSharp\Library\Microsoft.Bot.Builder\ConnectorEx\PostToBot.cs:line 103\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Dialogs.Internals.QueueDrainingDialogTask.d__4.MoveNext() in D:\a\1\s\CSharp\Library\Microsoft.Bot.Builder\Dialogs\DialogTask.cs:line 455\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Dialogs.Internals.PersistentDialogTask.d__3.MoveNext() in D:\a\1\s\CSharp\Library\Microsoft.Bot.Builder\Dialogs\DialogTask.cs:line 481\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at Microsoft.Bot.Builder.Dialogs.Internals.PersistentDialogTask.d__3.MoveNext() in D:\a\1\s\CSharp\Library\Microsoft.Bot.Builder\Dialogs\DialogTask.cs:line 485\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Dialogs.Internals.ExceptionTranslationDialogTask.d__2.MoveNext() in D:\a\1\s\CSharp\Library\Microsoft.Bot.Builder\Dialogs\DialogTask.cs:line 403\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at Microsoft.Bot.Builder.Dialogs.Internals.SerializeByConversation.d__4.MoveNext() in D:\a\1\s\CSharp\Library\Microsoft.Bot.Builder\ConnectorEx\PostToBot.cs:line 129\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at arcofel_UniversalBot.Dialogs.CustomPostUnhandledExceptionToUser.d__5.MoveNext() in C:\SW\dotnet\projects\arcofel Messenger\ArcofelMessengerBot-src\Dialogs\CustomPostUnhandledExceptionToUser.cs:line 37 Azure Web App bot the same information 401 Unauthorized { "type": "message", "timestamp": "2018-06-12T15:01:02.7672977+00:00", "localTimestamp": "2018-06-12T15:01:02.7672977+00:00", "serviceUrl": "https://facebook.botframework.com", "channelId": "facebook", "from": { "id": "1898523587053781", "name": "ArcofelMessengerBot" }, "conversation": { "isGroup": false, "id": "1664395866958984-1898523587053781" }, "recipient": { "id": "1664395866958984", "name": "Kevin Port" }, "text": "34: You said HI", "attachments": [], "entities": [], "replyToId": "mid.$cAAbkQRGlcGxqJcjiZ1j9IOZ8ZKBv" } https://facebook.botframework.com/v3/conversations/1664395866958984-1898523587053781/activities/mid.%24cAAbkQRGlcGxqJcjiZ1j9IOZ8ZKBv

Default Echo bot with CustomPostUnhandledExceptionToUser

kevinport avatar Jun 13 '18 17:06 kevinport

@ujwalakhaire @prorok-kane @kevinport Are your bots using the default state service? If not, what state store are they using?

EricDahlvang avatar Jun 14 '18 23:06 EricDahlvang

@EricDahlvang now InMemoryDataStore.

prorok-kane avatar Jun 15 '18 03:06 prorok-kane

@EricDahlvang TableBotDataStore, like the default azure bot template

kevinport avatar Jun 15 '18 07:06 kevinport

Hi,

I am using TableBotDataStore but would like to know if global.asax.cs below is right:

using Autofac; using Autofac.Integration.WebApi; using Microsoft.Bot.Builder.Azure; using Microsoft.Bot.Builder.Dialogs.Internals; using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Reflection; using System.Web.Http; using Microsoft.Bot.Builder.Dialogs; using Microsoft.Bot.Connector; using Microsoft.WindowsAzure.Storage; using System.Configuration;

namespace botzapprices2018 { public class Global : System.Web.HttpApplication { protected void Application_Start(object sender, EventArgs e) { { var config = GlobalConfiguration.Configuration; Conversation.UpdateContainer( builder => { builder.RegisterModule(new AzureModule(Assembly.GetExecutingAssembly()));

                    var store = new TableBotDataStore(ConfigurationManager.ConnectionStrings["StorageConnectionString"].ConnectionString);
                    builder.Register(c => store)
                        .Keyed<IBotDataStore<BotData>>(AzureModule.Key_DataStore)
                        .AsSelf()
                        .SingleInstance();

                    // Register your Web API controllers.
                    builder.RegisterApiControllers(Assembly.GetExecutingAssembly());
                    builder.RegisterWebApiFilterProvider(config);

                });

            config.DependencyResolver = new AutofacWebApiDependencyResolver(Conversation.Container);
        }

        // WebApiConfig stuff
        GlobalConfiguration.Configure(config =>
        {
            config.MapHttpAttributeRoutes();

            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
            );
        });
    }

    public static ILifetimeScope FindContainer()
    {
        var config = GlobalConfiguration.Configuration;
        var resolver = (AutofacWebApiDependencyResolver)config.DependencyResolver;
        return resolver.Container;
    }
}

}

JonesAbramoff avatar Jun 15 '18 16:06 JonesAbramoff

From the current Azure Template

`using Autofac; using System.Web.Http; using System.Configuration; using System.Reflection; using Microsoft.Bot.Builder.Azure; using Microsoft.Bot.Builder.Dialogs; using Microsoft.Bot.Builder.Dialogs.Internals; using Microsoft.Bot.Connector; using arcofel_UniversalBot.Dialogs;

namespace SimpleEchoBot { public class WebApiApplication : System.Web.HttpApplication { protected void Application_Start() { // Bot Storage: This is a great spot to register the private state storage for your bot. // We provide adapters for Azure Table, CosmosDb, SQL Azure, or you can implement your own! // For samples and documentation, see: https://github.com/Microsoft/BotBuilder-Azure

        Conversation.UpdateContainer(
            builder =>
            {
                builder.RegisterModule(new AzureModule(Assembly.GetExecutingAssembly()));

                // Using Azure Table Storage
                var store = new TableBotDataStore(ConfigurationManager.AppSettings["AzureWebJobsStorage"]); // requires Microsoft.BotBuilder.Azure Nuget package 

                // To use CosmosDb or InMemory storage instead of the default table storage, uncomment the corresponding line below
                // var store = new DocumentDbBotDataStore("cosmos db uri", "cosmos db key"); // requires Microsoft.BotBuilder.Azure Nuget package 
                // var store = new InMemoryDataStore(); // volatile in-memory store

                builder.Register(c => store)
                    .Keyed<IBotDataStore<BotData>>(AzureModule.Key_DataStore)
                    .AsSelf()
                    .SingleInstance();

                builder
 .RegisterType<CustomPostUnhandledExceptionToUser>()
 .Keyed<IPostToBot>(typeof(PostUnhandledExceptionToUser));

            });
        GlobalConfiguration.Configure(WebApiConfig.Register);
    }
}

} `

kevinport avatar Jun 15 '18 17:06 kevinport

@EricDahlvang We use TableBotDataStore

ujwalakhaire avatar Jun 15 '18 18:06 ujwalakhaire

Hi Kevin,

Thanks for your reply. I have already tried the global.asax.cs from the Azure template and others.

I am using the one from https://github.com/Microsoft/BotBuilder-Azure/blob/master/CSharp/Samples/AzureTable/Global.asax.cs .

May someone tell which one is better ?

JonesAbramoff avatar Jun 15 '18 18:06 JonesAbramoff

Hi, we recently started to get this issue and reported in the msdn forums and after a few replies they mentioned this issue.

  • Frequency. In almost every message.
  • What channels is this happening on? We have WebChat and DirectLine only and this is happening in both.
  • Type of bot Functions bot? Web App Bot deployed in our server and registered on Azure (Bot Channel Registration)
  • Is there any relevant info in app insights? The website https://webchat.botframework.com was down last Friday for a few hours, but when it went up we started to get this issue.
  • Timestamp and conversation ID when this occurs? Since last friday, near midday.
  • What state store is the bot using? TableBotDataStore

NioZero avatar Jun 21 '18 13:06 NioZero

Same here. Lib 3.15.2.2

  • Frequency - Only the first time after a longer disconnect to the bot. All calls afterwards are good, even when restarting the underlaying WebApp of the Bot.
  • We use MS Teams Channel and Direct Line - Seen on Direct Line. Not sure if also on MS Teams Channel as there is less traffic.
  • Deployment where is this happening - Till now no chance to reproduce this locally. Happens on Azure and of multiple environments (dev, staging, prod)

sebastianzolg avatar Jun 23 '18 09:06 sebastianzolg

Recently I got an update to the Nuget Packages System.IdentityModel.Tokens.Jwt and Microsoft.IdentityModel.Tokens (version 5.2.4 for both) and in my case the issue seems to be fixed and I don't have the Unauthorized response.

I will keep testing and checking in case something's wrong, but at first it seem resolved.

NioZero avatar Jun 25 '18 16:06 NioZero

Hi,

Even with 5.2.4 update it fails.

It was the first time in two days. I use web app, sdk 3.15.2.2, the fail was in Telegram, at 2018-06-27 05:23:34.777, with service url https://telegram.botframework.com and conversation id 371758214. Less than 2 seconds later the bot was able to send a message successfully.

It was the first message I was trying to send to this user in reply to its "/start" message .

JonesAbramoff avatar Jun 27 '18 13:06 JonesAbramoff

Hi,

we are getting this issue as well

  • Frequency: it is very randomly no frequency pattern so far (only 50 messages over the last 30 days out of thousands)
  • channels: this is happening in directline channel
  • Deployment: this is happening with an azure API app service
  • StateService: Cosmos Document Store
  • Stack Trace:
Microsoft.Bot.Connector.ErrorResponseException:
   at Microsoft.Bot.Connector.Conversations+<ReplyToActivityWithHttpMessagesAsync>d__8.MoveNext (Microsoft.Bot.Connector, Version=3.14.0.7, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at Microsoft.Bot.Connector.ConversationsExtensions+<ReplyToActivityAsync>d__7.MoveNext (Microsoft.Bot.Connector, Version=3.14.0.7, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at ZainOmniBot.Controllers.BotController+<sendReply>d__8.MoveNext (ZainOmniBot, Version=1.0.0.0, Culture=neutral, PublicKeyToken=nullZainOmniBot, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: C:\Users\admin\Desktop\Projects\zain_prototype\ZainOmniBot\Controllers\BotControllers\BotController.csZainOmniBot, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: 312)
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at ZainOmniBot.ZainBotController+<Greeting>d__19.MoveNext (ZainOmniBot, Version=1.0.0.0, Culture=neutral, PublicKeyToken=nullZainOmniBot, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: C:\Users\admin\Desktop\Projects\zain_prototype\ZainOmniBot\Controllers\BotControllers\ZainBotController.csZainOmniBot, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: 383)
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at ZainOmniBot.ZainBotController+<NonLoggedIn>d__11.MoveNext (ZainOmniBot, Version=1.0.0.0, Culture=neutral, PublicKeyToken=nullZainOmniBot, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: C:\Users\admin\Desktop\Projects\zain_prototype\ZainOmniBot\Controllers\BotControllers\ZainBotController.csZainOmniBot, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: 159)
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at ZainOmniBot.Controllers.BotController+<routeActivity>d__7.MoveNext (ZainOmniBot, Version=1.0.0.0, Culture=neutral, PublicKeyToken=nullZainOmniBot, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: C:\Users\admin\Desktop\Projects\zain_prototype\ZainOmniBot\Controllers\BotControllers\BotController.csZainOmniBot, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: 297)
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at ZainOmniBot.Controllers.BotController+<Post>d__5.MoveNext (ZainOmniBot, Version=1.0.0.0, Culture=neutral, PublicKeyToken=nullZainOmniBot, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: C:\Users\admin\Desktop\Projects\zain_prototype\ZainOmniBot\Controllers\BotControllers\BotController.csZainOmniBot, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: 67)
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Threading.Tasks.TaskHelpersExtensions+<CastToObject>d__1`1.MoveNext (System.Web.Http, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Web.Http.Controllers.ApiControllerActionInvoker+<InvokeActionAsyncCore>d__1.MoveNext (System.Web.Http, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Web.Http.Filters.ActionFilterAttribute+<CallOnActionExecutedAsync>d__6.MoveNext (System.Web.Http, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
   at System.Web.Http.Filters.ActionFilterAttribute+<CallOnActionExecutedAsync>d__6.MoveNext (System.Web.Http, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Web.Http.Filters.ActionFilterAttribute+<ExecuteActionFilterAsyncCore>d__5.MoveNext (System.Web.Http, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Web.Http.Controllers.ActionFilterResult+<ExecuteAsync>d__5.MoveNext (System.Web.Http, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Web.Http.Dispatcher.HttpControllerDispatcher+<SendAsync>d__15.MoveNext (System.Web.Http, Version=5.2.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)

Lepird avatar Jun 28 '18 09:06 Lepird

Hi, Can confirm this issue.

Frequency - Randomly. Mostly as soon as a user connects and bot send a greeting message. Out bot is deployed on directline channel. The bot is using Table storage for state service.

var store = new TableBotDataStore(ConfigurationManager.ConnectionStrings["StateStorageConnectionString"].ConnectionString);

             // Register bot data store to enable state management using database

                builder.Register(c => store)
                    .Keyed<IBotDataStore<BotData>>(AzureModule.Key_DataStore)
                    .AsSelf()
                    .SingleInstance();

                builder.Register(c => new CachingBotDataStore(store,
                         CachingBotDataStoreConsistencyPolicy.LastWriteWins))
                         .As<IBotDataStore<BotData>>()
                         .AsSelf()
                         .InstancePerLifetimeScope();

Some conversation id and timestamps :

Conversation ID Timestamps
CAQe8wxkmtmAWdfshvwzYS 2018-06-27T00:44:57.6233173+00:00
7KUUlIOqur3tYzBZXr34S 2018-06-26T01:54:10.118322+00:00
CKhvy5zMKmqCD9pI4g6sjF 2018-06-26T08:06:04.5426479+00:00
HPEw084s3j1A3ER61hKOoy 2018-06-25T18:06:15.8236009+00:00

Stack trace of 1 of the id can be found at this pastebin url

Kartik1607 avatar Jun 28 '18 10:06 Kartik1607

@ujwalakhaire @prorok-kane @kevinport @JonesAbramoff @NioZero @BenAffleckIsBatman @Lepird @Kartik1607 We have released a new package 3.15.2.3 that we believe addresses this issue. Please let us know if you are still experiencing this issue after upgrading.

JasonSowers avatar Jun 28 '18 16:06 JasonSowers

Hi,

I updated all nuget packages and got the same error.

Channel: Slack service URL: https://slack.botframework.com Conversation ID: BBFSMK2LA:TBGJN8ZHC:DBFPQMFKM Time: 2018-06-28 16:34:15.023 UTC−03:00

It was the first message.

I am using Global.asax.cs from https://github.com/Microsoft/BotBuilder-Azure/blob/master/CSharp/Samples/AzureTable/Global.asax.cs as posted earlier above.

Would you recommend to change it ?

JonesAbramoff avatar Jun 28 '18 20:06 JonesAbramoff

@JonesAbramoff have you only seen this on the first message? I notice you said this was the case on 2 posts in this thread. If this is the case, what you are seeing might be unrelated and will need to be investigated separately.

JasonSowers avatar Jun 28 '18 20:06 JasonSowers

Hi Jason,

I don´t know if my global.asax.cs is related to the unauthorized problem. It was just my guess.

It fails only a few times and almost always in my welcome (first) message.

JonesAbramoff avatar Jun 28 '18 21:06 JonesAbramoff