microsoft / botframework-sdk

Bot Framework provides the most comprehensive experience for building conversation applications.
MIT License
7.5k stars 2.44k forks source link

[.NET SDK] 401 Unauthorized in 3.15.2.2 #4733

Closed JasonSowers closed 6 years ago

JasonSowers commented 6 years ago

Bot Info

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

  1. Type of bot Functions bot? Web App bot?

  2. Is there any relevant info in app insights?

  3. Timestamp and conversation ID when this occurs?

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

ujwalakhaire commented 6 years ago

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
prorok-kane commented 6 years ago

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

kevinport commented 6 years ago

Every 2-5 hours, the first message Webchat, Facebook at Microsoft.Bot.Connector.Conversations.d9.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.d9.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.d4.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.d4.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.d3.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.d3.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.d4.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.d12.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.d14.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.d2.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.d5.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.d19.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>d9.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.d16.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.d3.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.d5.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.d19.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>d9.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.d16.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.d23.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.d3.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.d5.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.d3.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.d3.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.d4.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.d3.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.d3.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.d2.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.d4.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.d5.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

EricDahlvang commented 6 years ago

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

prorok-kane commented 6 years ago

@EricDahlvang now InMemoryDataStore.

kevinport commented 6 years ago

@EricDahlvang TableBotDataStore, like the default azure bot template

JonesAbramoff commented 6 years ago

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;
    }
}

}

kevinport commented 6 years ago

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);
    }
}

} `

ujwalakhaire commented 6 years ago

@EricDahlvang We use TableBotDataStore

JonesAbramoff commented 6 years ago

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 ?

NioZero commented 6 years ago

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

sebastianzolg commented 6 years ago

Same here. Lib 3.15.2.2

NioZero commented 6 years ago

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.

JonesAbramoff commented 6 years ago

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 .

Lepird commented 6 years ago

Hi,

we are getting this issue as well

Kartik1607 commented 6 years ago

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

JasonSowers commented 6 years ago

@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.

JonesAbramoff commented 6 years ago

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 ?

JasonSowers commented 6 years ago

@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.

JonesAbramoff commented 6 years ago

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 commented 6 years ago

It happened again:

Channel: Telegram Service URL: https://telegram.botframework.com Conversation Id: 446555179 Time: 2018-06-29 01:03:17.657 UTC−03:00

It was responding to /start with a new contact using the function SelecionaPais2. In its catch code I call SelecionaPais3 that works.

    public static async Task<string> SelecionaPais2(Activity activity)
    {
        try
        {
            // Use the data stored previously to create the required objects.
            var userAccount = new ChannelAccount(activity.From.Id, activity.From.Name);
            var botAccount = new ChannelAccount(activity.Recipient.Id, activity.Recipient.Name);

            ConnectorClient connector = ConnectorClient_Obter(activity.ServiceUrl);

            // Create a new message.
            IMessageActivity message = Activity.CreateMessageActivity();
            message.ServiceUrl = activity.ServiceUrl;
            message.ChannelId = activity.ChannelId;
            string IdConversa = "";
            if (string.IsNullOrEmpty(activity.Conversation.Id))
            {
                // Conversation ID was not stored previously, so create a conversation. 
                // Note: If the user has an existing conversation in a channel, this will likely create a new conversation window.
                IdConversa = (await connector.Conversations.CreateDirectConversationAsync(botAccount, userAccount)).Id;
            }
            else
            {
                IdConversa = activity.Conversation.Id;
            }

            SelecionaPais_Preenche_Msg(message);

            // Set the address-related properties in the message and send the message.
            message.From = botAccount;
            message.Recipient = userAccount;
            message.Conversation = new ConversationAccount(id: IdConversa);
            message.Locale = "pt-BR";
            await connector.Conversations.SendToConversationAsync((Activity)message);

            Utils.Log_Grava("sucesso em SelecionaPais2");
        }
        catch (Exception ex)
        {
            Utils.Log_Grava($"SelecionaPais2 Failed with message: {ex.Message}");

            await SelecionaPais3(activity.ChannelId,activity.ServiceUrl, activity.From.Id, activity.From.Name, activity.Recipient.Id, activity.Recipient.Name);
        }
        return ("");
    }

    public static async Task<string> SelecionaPais3(string IDCanal, string ServiceURL, string IdUsuario, string NomeUsuario, string IdBot, string NomeBot)
    {
        try
        {
            // Use the data stored previously to create the required objects.
            var userAccount = new ChannelAccount(IdUsuario, NomeUsuario);
            var botAccount = new ChannelAccount(IdBot, NomeBot);

            ConnectorClient connector = ConnectorClient_Obter(ServiceURL);

            // Create a new message.
            IMessageActivity message = Activity.CreateMessageActivity();
            message.ChannelId = IDCanal;

            message.ServiceUrl = ServiceURL;

            // Conversation ID was not stored previously, so create a conversation. 
            // Note: If the user has an existing conversation in a channel, this will likely create a new conversation window.
            string IdConversa = (await connector.Conversations.CreateDirectConversationAsync(botAccount, userAccount)).Id;

            SelecionaPais_Preenche_Msg(message);

            // Set the address-related properties in the message and send the message.
            message.From = botAccount;
            message.Recipient = userAccount;
            message.Conversation = new ConversationAccount(id: IdConversa);
            message.Locale = "pt-BR";
            await connector.Conversations.SendToConversationAsync((Activity)message);

            Utils.Log_Grava("sucesso em SelecionaPais3");
        }
        catch (Exception ex)
        {
            Utils.Log_Grava($"SelecionaPais3 Failed with message: {ex.Message}");
        }
        return ("");
    }
    public static void SelecionaPais_Preenche_Msg(IMessageActivity message)
    {
        try
        {
            message.Text = "Welcome! I am a bot that compares prices among stores!";

            message.Attachments.Add(
                new HeroCard
                {
                    Subtitle = "Please select a country:",
                    Buttons = new List<CardAction> {
                        new CardAction(ActionTypes.ImBack, $"Australia", value: $"AU", text: $"Australia", displayText: $"Australia"),
                        new CardAction(ActionTypes.ImBack, $"Brasil", value: $"BR", text: $"Brasil", displayText: $"Brasil"),
                        new CardAction(ActionTypes.ImBack, $"Canada", value: $"CA", text: $"Canada", displayText: $"Canada"),
                        new CardAction(ActionTypes.ImBack, $"Deutschland", value: $"DE", text: $"Deutschland", displayText: $"Deutschland"),
                        new CardAction(ActionTypes.ImBack, $"España", value: $"ES", text: $"España", displayText: $"España"),
                        new CardAction(ActionTypes.ImBack, $"France", value: $"FR", text: $"France", displayText: $"France"),
                        new CardAction(ActionTypes.ImBack, $"India", value: $"IN", text: $"India", displayText: $"India"),
                        new CardAction(ActionTypes.ImBack, $"Italia", value: $"IT", text: $"Italia", displayText: $"Italia"),
                        new CardAction(ActionTypes.ImBack, $"México", value: $"MX", text: $"México", displayText: $"México"),
                        new CardAction(ActionTypes.ImBack, $"Nederland", value: $"NL", text: $"Nederland", displayText: $"Nederland"),
                        new CardAction(ActionTypes.ImBack, $"United Kingdom", value: $"GB", text: $"United Kingdom", displayText: $"United Kingdom"),
                        new CardAction(ActionTypes.ImBack, $"United States", value: $"US", text: $"United States", displayText: $"United States"),
                        new CardAction(ActionTypes.ImBack, $"Россия (Russia)", value: $"RU", text: $"Россия (Russia)", displayText: $"Россия (Russia)"),
                    }
                }.ToAttachment()
            );
        }
        catch (Exception ex)
        {
            Utils.Log_Grava($"SelecionaPais_Preenche_Msg Failed with message: {ex.Message}");
        }
    }
JasonSowers commented 6 years ago

You all may want to hold off on upgrading we will have another new version dropping soon. 3.15.3

JonesAbramoff commented 6 years ago

Same error with 3.15.3. Always in proactive message that called a second later works fine. I will change my code to retry when fails.

JasonSowers commented 6 years ago

@JonesAbramoff will you start a new issue detailing your issue. It seems yours is not related to the fix we recently put in. I would like to track it separately from this issue so we can look into it.

I am going to leave this issue open for this week to monitor any other reports.

Kartik1607 commented 6 years ago

Although frequency has decreased but the issue still exists in the updated code. Occurred 5 times in past 3 days. Only occurring after the first greeting message sent by bot.

Conversation ID Timestamps
HZCFg6owRc8FDBGlvlOpqi 2018-06-30T10:54:04.6611466+00:00
2kbLKBZ83QPLbqr8iAF1h1 2018-06-30T23:13:55.0952924+00:00
1D0diPwsKoXMjvR89iqeu 2018-07-01T13:05:13.5875871+00:00
CycJsRiEzAR2NPwgu3V3v1 2018-07-02T18:48:07.8127725+00:00
9zvkjcwLTZaE1buVViJ58E 2018-07-02T20:17:07.4171416+00:00

The exceptions occur when the bot had been idle for a long period like for 2-3 hours.

asfyra commented 6 years ago

The same problem for our app.

  1. The frequency is about 1 to 2 hours of bot inactivity.
  2. We use WebChat and DirectLine channels. Both channels show the error.
  3. After 3.15.3 the error is not showing in appInsights nor on the "Health" column is the Channels tab of bot configuration page through azure portal. The "Health" column now shows "Running".
  4. We didn't have the chance to see this error happening localy on the emulator. In our case the error is on the Azure deployment,
  5. Our bot is a WebAppBot deployed on Azure
  6. After 3.15.3 app insights does not capture the error
  7. I don't have the excat timestamp as nothing is logged anymore. The error occured today around 4:30am UTC, yesterday night around 7:00pm to 8:00pm UTC. Whenever the bot is idle in general and after 1 to two hours of inactivity. I could be more specific on the times the error occures if needed.
  8. For the bot state we are using CosmosDB excactly as it is shown in the documentation.

Thanks in advance for your support Alex

JasonSowers commented 6 years ago

Thanks for reporting your results all, we will continue to look into this.

Looks like you are not alone here @JonesAbramoff

JonesAbramoff commented 6 years ago

Hi Jason,

This problem has been around since March 15 in issue 4321 and I would like to contribute to solve it as I can. I can privately send you my source code or change it to include whatever debugging code you ask.

Right now all my messages to the user have a retry to be used when the first attempt fails.

Best regards,

Jones

ahqiu89 commented 6 years ago

Hi, experienced the same.

Bot Info SDK Platform: C# SDK Version: 3.12.2.4 Active Channels: Web chat, FB Deployment Environment: On-Premise

Frequency - Happen on all the messages. Never success on sending out one. Stack trace - There was an error sending this message to your bot: HTTP status code Unauthorized Deployment where is this happening - On prem, local testing is fine. State Service: Default state service

Issue Description: Found bot no response from FB recently. Last working response received was in June 2018. Tried to troubleshoot by testing bot in Azure web chat, the message couldnt send. Web Chat issue logged: There was an error sending this message to your bot: HTTP status code Unauthorized. However with the same code, the bot is functional when using emulator.

Code Example In web.config, set microsoftappid, microsoftapppassword:

add key="MicrosoftAppId" value="0f5b4ab2-800a-4447-bfe7-c89ad9d90719" add key="MicrosoftAppPassword" value="xxxxxxxx"

In Message controller:

public async Task<HttpResponseMessage> Post([FromBody]Activity activity)
{
        if (activity.Type == ActivityTypes.Message)
        {
            var connector = new ConnectorClient(new Uri(activity.ServiceUrl));
            Activity isTypingReply = activity.CreateReply();
            isTypingReply.Type = ActivityTypes.Typing;
            await connector.Conversations.ReplyToActivityAsync(isTypingReply);

            await Conversation.SendAsync(activity, () => new Dialogs.ExceptionHandlerDialog<object>(
                new Dialogs.RootDialog()
            ));

        }
        else
        {
            HandleSystemMessage(activity);
        }
        var response = Request.CreateResponse(HttpStatusCode.OK);
        return response;
}

Reproduction Steps https://www.facebook.com/messages/t/mayabotdemo, try talk to the bot. Please advise if the way if the team wants to test out the azure web chat.

Expected Behavior The bot will able to respond after received user's reply.

Actual Results The bot does not reply now due to error logged in azure. There was an error sending this message to your bot: HTTP status code Unauthorized.

JasonSowers commented 6 years ago

@JonesAbramoff if you think you have a fix please submit a pull request. If you do not want to submit one you can send the code to the email in my profile.

JonesAbramoff commented 6 years ago

Sorry, I have no fix to suggest. I am only using a very ugly retry code to live with this failures.

EricDahlvang commented 6 years ago

@huyjack178 has provided an interesting workaround to avoid this error here: https://github.com/Microsoft/BotBuilder/issues/4322#issuecomment-405528802

asfyra commented 6 years ago

@huyjack178 thank you for mentioning that post, but what if the bot is hosted as Azure web app and it is being consumed by webchat, or directline channels? Is there any hint on how i could update the connector token?

EricDahlvang commented 6 years ago

@asfyra There is example code here: https://blog.botframework.com/2017/11/02/optimizing-latency-bot-framework/ demonstrating how to add code for periodically refreshing the token.

ujwalakhaire commented 6 years ago

We upgraded to latest version of bot builder SDK (3.15.3) and we see this issue lot less frequently now.

asfyra commented 6 years ago

@ujwalakhaire We are also on the latest version (3.15.3) but the issue remains. Just leave the bot inactive for a couple of hours and the error returns :cry:

kevinport commented 6 years ago

This bug should have the highest priority.

JasonSowers commented 6 years ago

We are actively looking into this.

premaarya commented 6 years ago

Me Too

libihan commented 6 years ago

I meet the same problem when I use Keyvault to store my ids and keys.

I have to be tortured crazy recently.


SDK Platform: .Net

【Frequency】: After one hour I deploy, it responds nothing. Every message. No matter what I send to Bot, it responds nothing.

【Channel】: MS Teams. Web chat is ok. Or sometimes Web chat exists this problem suddenly, but it recovers quickly.

【Deployment】: Locally git to Azure

【Type of bot Functions bot】: Web App Bot. (QnA surely has this problem, LUIS maybe(I am testing))

【Is there any relevant info in app insights】: I don't know know how to see app insights about MS Teams in Azure. I get this exception just in Web chat's app insights by chance.

【Details】: { "message": "An error has occurred.", "exceptionMessage": "Operation returned an invalid status code 'Unauthorized'", "exceptionType": "Microsoft.Bot.Connector.ErrorResponseException",

"stackTrace": " 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

egracer commented 6 years ago

This is happening for my bot as well, details:

1) Frequency - Roughly once every 24 hours, usually between 10:00 and 10:30 UTC (which, as others have commented, is usually after a longer period of inactivity for our bot) 2) Channel - Direct Line. We're only on this channel so I can't speak to other ones. 3) Stack trace:

Operation returned an invalid status code 'Unauthorized'
**************************************************
StatusCode=401
ReasonPhrase=Unauthorized
Request=Microsoft.Rest.HttpRequestMessageWrapper
Response=Microsoft.Rest.HttpResponseMessageWrapper
TargetSite=Void MoveNext()
Source=Microsoft.Bot.Connector
HResult=-2146233088
StackTrace
**************************************************
   at Microsoft.Bot.Connector.Conversations.<SendToConversationWithHttpMessagesAsync>d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Bot.Connector.ConversationsExtensions.<SendToConversationAsync>d__5.MoveNext()

4) Deployment - Customized container orchestration service (hosted in Azure East US 2) 5) Bot type - Self hosted 6) No relevant info in App Insights. One or two requests fail to authorize, and all subsequent requests succeed for approximately the next 24 hours. 7) Some conversation ID (directline) / timestamp (UTC) pairs:

Rt7tQfIk8e6wPhDyWYPzr / 2018-07-30 10:15:24.4937
18XZnA6tIWb435j6DxkJRZ / 2018-07-28 10:27:01.8811
HkJ3HIQZMP87rN6BZM9pXL / 2018-07-27 13:34:12.1247
AgrLyhLJUPtEHJ7za2haPQ / 2018-07-26 10:09:22.2380
kUkM3l6ihH5MX0Jn5ziy / 2018-07-25 10:01:47.4448

8) We use the DocumentDbBotDataStore implementation of IBotDataStore for state storage in CosmosDB.

petrformanek commented 6 years ago

Hi, I'm facing this issue to. It happens randomly like once a day after longer bot inactivity. I updated to latest version of bot builder SDK (3.15.3)

aymandaqa commented 6 years ago

Hi, I'm facing this issue to. I updated to latest version of bot builder SDK (3.15.3):

Sunday, August 05, 2018

MessagesController, Post Medium Error Error Microsoft.Bot.Connector Operation returned an invalid status code 'MethodNotAllowed' MoveNext Microsoft.Rest.HttpOperationException e-career-temp 10.103.201.50 at Microsoft.Bot.Connector.BotState.d__8.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Bot.Connector.BotStateExtensions.d__7.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Bot.Builder.Dialogs.Internals.ConnectorStore.-LoadAsync>d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Bot.Builder.Dialogs.Internals.CachingBotDataStore.d__8.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Bot.Builder.Dialogs.Internals.CachingBotDataStore.-LoadAsync>d__6.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Bot.Builder.Dialogs.Internals.BotDataBase`1.d__16.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Bot.Builder.Dialogs.Internals.BotDataBase`1.d__8.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Bot.Builder.Dialogs.Internals.DialogTaskManagerBotDataLoader.d__11.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Bot.Builder.Dialogs.Internals.PersistentDialogTask.d__3.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Bot.Builder.Dialogs.Internals.ExceptionTranslationDialogTask.d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Bot.Builder.Dialogs.Internals.SerializeByConversation.d__4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Bot.Builder.Dialogs.Internals.PostUnhandledExceptionToUser.d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.Bot.Builder.Dialogs.Internals.PostUnhandledExceptionToUser.d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Bot.Builder.Dialogs.Internals.LogPostToBot.d__3.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Bot.Builder.Dialogs.Conversation.d__11.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Bot.Builder.Dialogs.Conversation.d__6.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at RechChatBotAppBot.MessagesController.d__9.MoveNext() in E:\New folder (11)\RechChatBotAppBot\RechChatBotAppBot\Controllers\MessagesController.cs:line 126
danmasterson commented 6 years ago

I am experiencing the problem with : Microsoft.Bot.Schema.BotTimeoutException: POST to MyMangosteenBotReg timed out after 15s at Microsoft.Bot.ChannelConnector.BotAPI+d__30.MoveNext (Microsoft.Bot.ChannelConnector, Version=3.2.2.2, Culture=neutral, PublicKeyToken=null)

I am using the latest Bot.builder SDK 3.15.3

It happens periodically and it seems to happen after a user is inactive but it happens at different time periods. Other users can be using the bot and not experience the issue.

In order to clear it, I have to stop and restart the app.

I am using the Facebook Channel exclusively other than testing.

I am in a pickle here because I assured my bosses that it was a good thing to build on top of the Microsoft infrastructure. We are trying to launch a new product using the bot this week. Please help.

petrformanek commented 6 years ago

Hi, I'm using bot within following scenario:

When bot is idle e.g. for a couple of hours I sometimes get Unauthorized exception when bot is trying to reply.

I'm tried following workaround which seems that fixes the issue:

JasonSowers commented 6 years ago

I have some good news, we have a release that should address this issue coming out soon. If you would like to test it you can try the build on our MyGet daily build feed

@aymandaqa your problem seems to be unrelated, can you please open a new issue and share the code from your messages controller.

ani-sm commented 6 years ago

I had the same issues mentioned in this thread. The bot wouldn't work when authentication is turned on and gave me 401 errors. Now I have upgraded to the new 3.16 bot builder update and I get following compile time errors CS1705 Assembly 'Microsoft.Bot.Builder' with identity 'Microsoft.Bot.Builder, Version=3.16.0.37658, Culture=neutral, PublicKeyToken=xxxx' uses 'Microsoft.Bot.Connector, Version=3.16.0.37658, Culture=neutral, PublicKeyToken=xxxx' which has a higher version than referenced assembly 'Microsoft.Bot.Connector' with identity 'Microsoft.Bot.Connector, Version=3.15.3.0, Culture=neutral, PublicKeyToken=yyy' VendorDetailsBotApplicationWithLUIS

What gives?

JasonSowers commented 6 years ago

@ani-sm somehow the versions got out of sync. if you upgrade your packages using these commands for bot.builder and bot.connector the packages should install correctly. I just tested it and was able to successfully build. Basically the solution is to install the 3.16.0.37621 versions of both. We will get this sorted out moving forward.

Microsoft.Bot.Builder:

Install-Package Microsoft.Bot.Builder -Version 3.16.0.37621 -Source https://botbuilder.myget.org/F/botbuilder-v3-dotnet-daily/api/v3/index.json

Microsoft.Bot.Connector:

Install-Package Microsoft.Bot.Connector -Version 3.16.0.37621 -Source https://botbuilder.myget.org/F/botbuilder-v3-dotnet-daily/api/v3/index.json
ani-sm commented 6 years ago

A couple updates... @JasonSowers Thanks.. that helped... I did get some compile errors but now I able to test the bot in the emulator with authentication turned on. I have deployed it to Azure and with all settings in place I'm getting "Sorry, my bot code is having an issue." errors. When I debugg it with ngrok I see some messages due to using default state. Since using default state is not allowed in production, could this be the case for the error above? Or can it be still related to the Bot authentication ?

Diving Deep...will provide more updates when I surface!

JasonSowers commented 6 years ago

It's hard to say without seeing your code @ani-sm. "Sorry, my bot code is having an issue." is a catch-all error that doesn't provide much information. A stack trace or some code where the error is occurring may help to diagnose.