[.NET SDK] 401 Unauthorized in <IP_ADDRESS>

Bot Info

SDK Platform: .Net
SDK Version: <IP_ADDRESS>

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

Frequency - How often is this happening? Every message? Randomly and how often ex. 1 out of 10 messages
What channels is this happening on, is it working on any channels?
Stack trace
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?

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

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

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

2-3 hours, can appears in background job logs.
Telegram
StackTrace.txt
Azure
Web App (Actualy don't understand this question)
Disabled right now
2018-06-12 12:57:38.4186 and -230902953

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

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

@EricDahlvang now InMemoryDataStore.

@EricDahlvang TableBotDataStore, like the default azure bot template

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

}

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

}
`

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 ?

Hi,
Authorization was failing while sending the first message back in a conversation and I changed my code to use connector.Conversations.SendToConversationAsync instead of PostAsync.
In order to create the connector I followed the recomendation in https://stackoverflow.com/questions/42749982/initiate-a-message-from-bot-to-user-on-botframework/42784932:
            MicrosoftAppCredentials.TrustServiceUrl(ServiceUrl, DateTime.Now.AddDays(7));
            var account = new MicrosoftAppCredentials("---replace with AppId----", "----replace with password");
            var connector = new ConnectorClient(new Uri(ServiceUrl), account);

And so far, so good.

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

Same here. Lib <IP_ADDRESS>

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)

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

Hi,
Even with 5.2.4 update it fails.
It was the first time in two days. I use web app, sdk <IP_ADDRESS>, 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 .

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=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (mscorlib, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at Microsoft.Bot.Connector.ConversationsExtensions+<ReplyToActivityAsync>d__7.MoveNext (Microsoft.Bot.Connector, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (mscorlib, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at ZainOmniBot.Controllers.BotController+<sendReply>d__8.MoveNext (ZainOmniBot, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=nullZainOmniBot, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=null: C:\Users\admin\Desktop\Projects\zain_prototype\ZainOmniBot\Controllers\BotControllers\BotController.csZainOmniBot, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=null: 312)
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (mscorlib, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at ZainOmniBot.ZainBotController+<Greeting>d__19.MoveNext (ZainOmniBot, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=nullZainOmniBot, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=null: C:\Users\admin\Desktop\Projects\zain_prototype\ZainOmniBot\Controllers\BotControllers\ZainBotController.csZainOmniBot, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=null: 383)
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (mscorlib, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at ZainOmniBot.ZainBotController+<NonLoggedIn>d__11.MoveNext (ZainOmniBot, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=nullZainOmniBot, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=null: C:\Users\admin\Desktop\Projects\zain_prototype\ZainOmniBot\Controllers\BotControllers\ZainBotController.csZainOmniBot, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=null: 159)
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (mscorlib, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (mscorlib, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at ZainOmniBot.Controllers.BotController+<routeActivity>d__7.MoveNext (ZainOmniBot, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=nullZainOmniBot, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=null: C:\Users\admin\Desktop\Projects\zain_prototype\ZainOmniBot\Controllers\BotControllers\BotController.csZainOmniBot, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=null: 297)
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (mscorlib, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at ZainOmniBot.Controllers.BotController+<Post>d__5.MoveNext (ZainOmniBot, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=nullZainOmniBot, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=null: C:\Users\admin\Desktop\Projects\zain_prototype\ZainOmniBot\Controllers\BotControllers\BotController.csZainOmniBot, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=null: 67)
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (mscorlib, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Threading.Tasks.TaskHelpersExtensions+<CastToObject>d__1`1.MoveNext (System.Web.Http, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (mscorlib, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Web.Http.Controllers.ApiControllerActionInvoker+<InvokeActionAsyncCore>d__1.MoveNext (System.Web.Http, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (mscorlib, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Web.Http.Filters.ActionFilterAttribute+<CallOnActionExecutedAsync>d__6.MoveNext (System.Web.Http, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
   at System.Web.Http.Filters.ActionFilterAttribute+<CallOnActionExecutedAsync>d__6.MoveNext (System.Web.Http, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (mscorlib, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Web.Http.Filters.ActionFilterAttribute+<ExecuteActionFilterAsyncCore>d__5.MoveNext (System.Web.Http, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (mscorlib, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Web.Http.Controllers.ActionFilterResult+<ExecuteAsync>d__5.MoveNext (System.Web.Http, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=31bf3856ad364e35)
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (mscorlib, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (mscorlib, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=b77a5c561934e089)
   at System.Web.Http.Dispatcher.HttpControllerDispatcher+<SendAsync>d__15.MoveNext (System.Web.Http, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=31bf3856ad364e35)

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

We have released a new package  <IP_ADDRESS> that we believe addresses this issue.  Please let us know if you are still experiencing this issue.

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

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

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

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

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

Same error with 3.15.3

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

Although frequency has decreased but the issue still exists in the updated code. Occurred 5 times in past 3 days.

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 same problem for our app.

The frequency is about 1 to 2 hours of bot inactivity.
We use WebChat and DirectLine channels. Both channels show the error.
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".
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,
Our bot is a WebAppBot deployed on Azure
After 3.15.3 app insights does not capture the error
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.
For the bot state we are using CosmosDB excactly as it is shown in the documentation.

Thanks in advance for your support
Alex

Thanks for reporting your results all, we will continue to look into this.
Looks like you are not alone here @JonesAbramoff

Hi,
I will downgrade to <IP_ADDRESS> and wait until this problem is fixed because in 3.15.3 some messages are not being sent to the user without raising exception.

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

Hi, experienced the same.
Bot Info
SDK Platform: C#
SDK Version: <IP_ADDRESS>
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.

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

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

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

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

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

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

This bug should have the highest priority.

We are actively looking into this.

Me Too

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

This is happening for my bot as well, details:

Frequency - Roughly once every 24 hours, usually between 10:00 and 10:30 UTC
Channel - Direct Line. We're only on this channel so I can't speak to other ones.
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()

Deployment - Customized container orchestration service (hosted in Azure East US 2)
Bot type - Self hosted
No relevant info in App Insights. One or two requests fail to authorize, and all subsequent requests succeed for approximately the next 24 hours.
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

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

Hi,
I'm facing this issue to. I updated to latest version of bot builder SDK (3.15.3):
Sunday, August 05, 2018
12:11:21 PM
MessagesController, Post
Medium
Error
Error
Microsoft.Bot.Connector
Operation returned an invalid status code 'MethodNotAllowed'
MoveNext
Microsoft.Rest.HttpOperationException
e-career-temp

<IP_ADDRESS>
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.<Microsoft-Bot-Builder-Dialogs-Internals-IBotDataStore-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.<Microsoft-Bot-Builder-Dialogs-Internals-IBotDataStore-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.BotDataBase1.<LoadData>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.BotDataBase1.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

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=<IP_ADDRESS>, 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.

Hi,
I'm using bot within following scenario:

webchat sends initConversation event at the beginning of a conversation
bot replies on it with welcome message.

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:

call GetTokenAsync() on MicrosoftAppCredentials of your bot just before reply

if (string.Equals("initConversationEvent", message.Name, StringComparison.OrdinalIgnoreCase))
{
	// possible workaround to avoid occasional 401 http errors when replying back to user, see https://github.com/Microsoft/BotBuilder/issues/4733
	await _botRegistrationAppCredentials.GetTokenAsync();

	await ReplyWithWelcomeMessageAsync(message);
}

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

@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 <IP_ADDRESS>621 versions of both.
Microsoft.Bot.Builder:
Install-Package Microsoft.Bot.Builder -Version <IP_ADDRESS>621 -Source https://botbuilder.myget.org/F/botbuilder-v3-dotnet-daily/api/v3/index.json

Microsoft.Bot.Connector:
Install-Package Microsoft.Bot.Connector -Version <IP_ADDRESS>621 -Source https://botbuilder.myget.org/F/botbuilder-v3-dotnet-daily/api/v3/index.json

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!

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.

I'm suffering from this issue too, every time I update the packages recently a new issues seems to come up that only becomes apparent when the app is subjected to large amounts of use in production when it's too late. I'd only recently upgraded to avoid the issue many others were suffering whereby the bot would forget it's state (https://github.com/Microsoft/BotBuilder/issues/4477). Really disappointing.
Happens in production using a Web App Bot and Azure.
Here is the stack trace:
ErrorResponseException: Operation returned an invalid status code 'Unauthorized'   Module "Microsoft.Bot.Connector.Conversations", line 1430, col 0, in ReplyToActivityWithHttpMessagesAsync     Void MoveNext()   Module "System.Runtime.CompilerServices.TaskAwaiter", line 26, col 0, in ThrowForNonSuccess     Void ThrowForNonSuccess(System.Threading.Tasks.Task)   Module "System.Runtime.CompilerServices.TaskAwaiter", line 40, col 0, in HandleNonSuccessAndDebuggerNotification     Void HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)   Module "Microsoft.Bot.Connector.ConversationsExtensions", line 211, col 0, in ReplyToActivityAsync     Void MoveNext()   Module "System.Runtime.CompilerServices.TaskAwaiter", line 26, col 0, in ThrowForNonSuccess     Void ThrowForNonSuccess(System.Threading.Tasks.Task)   Module "System.Runtime.CompilerServices.TaskAwaiter", line 40, col 0, in HandleNonSuccessAndDebuggerNotification     Void HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)   Module "Microsoft.Bot.Builder.Dialogs.Internals.AlwaysSendDirect_BotToUser+<Microsoft-Bot-Builder-Dialogs-Internals-IBotToUser-PostAsync>d__4", line 125, col 0, in MoveNext     Void MoveNext()   Module "System.Runtime.CompilerServices.TaskAwaiter", line 26, col 0, in ThrowForNonSuccess     Void ThrowForNonSuccess(System.Threading.Tasks.Task)   Module "System.Runtime.CompilerServices.TaskAwaiter", line 40, col 0, in HandleNonSuccessAndDebuggerNotification     Void HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)   Module "Microsoft.Bot.Builder.Dialogs.Internals.InputHintQueue+<Microsoft-Bot-Builder-Dialogs-Internals-IMessageQueue-QueueMessageAsync>d__4", line 308, col 0, in MoveNext     Void MoveNext()

We are also facing the same issue:
Frequency - randomly after 1 or 2 hrs (Users in PROD are getting frustrated with this issue)
What channels is this happening on, is it working on any channels? - Web Chat
Stack trace
[{"parsedStack":[{"assembly":"Microsoft.Bot.Connector, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=31bf3856ad364e35","method":"Microsoft.Bot.Connector.Conversations+d__7.MoveNext","level":0,"line":0},{"assembly":"mscorlib, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=b77a5c561934e089","method":"System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess","level":1,"line":0},{"assembly":"mscorlib, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=b77a5c561934e089","method":"System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification","level":2,"line":0},{"assembly":"Microsoft.Bot.Connector, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=31bf3856ad364e35","method":"Microsoft.Bot.Connector.ConversationsExtensions+d__5.MoveNext","level":3,"line":0},{"assembly":"mscorlib, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=b77a5c561934e089","method":"System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess","level":4,"line":0},{"assembly":"mscorlib, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=b77a5c561934e089","method":"System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification","level":5,"line":0},{"assembly":"mscorlib, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=b77a5c561934e089","method":"System.Runtime.CompilerServices.TaskAwaiter`1.GetResult","level":6,"line":0},{"assembly":"SupportBot, Version=<IP_ADDRESS>, Culture=neutral, PublicKeyToken=null","method":"SupportBot.MessagesController+<>c__DisplayClass1_0+<b__0>d.MoveNext","level":7,"line":138,"fileName":"\SupportBot\Controllers\MessagesController.cs"}],"outerId":"0","message":"Operation returned an invalid status code 'Unauthorized'","type":"Microsoft.Bot.Connector.ErrorResponseException","id":"42471124"}]
Deployment where is this happening - Local testing? Azure? Both? -- Azure

I got around this issue by moving from the table interface and moving to the SQL (DocumentDB) interface.  Why that cleared up the problem I don't know, but the majority of the people having problems were using the table interface it seemed to me.

Thank you for opening an issue against the Bot Framework SDK v3. As part of the Bot Framework v4 release, we’ve moved all v3 work to a new repo located at https://github.com/microsoft/botbuilder-v3. We will continue to support and offer maintenance updates to v3 via this new repo.
From now on, https://github.com/microsoft/botbuilder repo will be used as hub, with pointers to all the different SDK languages, tools and samples repos.
As part of this restructuring, we are closing all tickets in this repo.
For defects or feature requests, please create a new issue in the new Bot Framework v3 repo found here:
https://github.com/microsoft/botbuilder-v3/issues
For Azure Bot Service Channel specific defects or feature requests (e.g. Facebook, Twilio, Teams, Slack, etc.), please create a new issue in the new Bot Framework Channel repo found here:
https://github.com/microsoft/botframework-services/issues
For product behavior, how-to, or general understanding questions, please use Stackoverflow.
https://stackoverflow.com/search?q=bot+framework
Thank you.
The Bot Framework Team

Hi,
We are still facing the issue un <IP_ADDRESS>

Frequency - How often is this happening? Every message? Randomly and how often ex. 1 out of 10 messages  => Daily 1 time for the first user
What channels is this happening on, is it working on any channels? => Webchat
Stack trace =>

directline.botframework.com | HTTP | POST   /v3/conversations//activities/ | https://directline.botframework.com/v3/conversations//activities/ | FALSE | 401 | 434 | 250ms-500ms

Deployment where is this happening - Local testing? Azure? Both? Azure Hosting

@alokraj68 This issue was fixed with 3.19.n  Please upgrade to the latest Bot Builder V3 version: https://www.nuget.org/packages/Microsoft.Bot.Builder/3.20.1

@EricDahlvang
We did updated to 3.20.1 and deployed but yet to test for few days to confirm.
Thanks for quick reply.


ReferenceError: navigator is not defined

while access page that has calendar via url (server side) there's error
ReferenceError: navigator is not defined on checkMobile.js:5:5
if I access that page via link react-routers (client side) it's work
using semantic-ui-react 0.87.1;

Thanks for report! I'll fix it.

Also seeing this error, but for some reason it's happening during webpack build for production in a Gatsby site.

is it fixed ???

No, but forked and built with a patch. I was gonna pr it but there are unrelated broken unit tests in the project as that I didn't/don't have time to fix

@DannyHinshaw make a pr with broken unit tests.


[WIP]beakerbrowser:init at 0.8.8

Motivation for this change
Solves https://github.com/NixOS/nixpkgs/issues/38037
Things done

Not yet wrking
nix build -f . 'nodePackages."beakerbrowser-git+https://github.com/beakerbrowser/beaker.git"'
error: 'buildNodePackage' at /home/paki/src/nixpkgs/pkgs/development/node-packages/node-env.nix:377:5 called without required argument 'version', at /home/paki/src/nixpkgs/lib/customisation.nix:69:12

[ ] Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
Built on platform(s)

[ ] NixOS
[ ] macOS
[ ] other Linux distributions

[ ] Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
[ ] Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
[ ] Tested execution of all binary files (usually in ./result/bin/)
[ ] Determined the impact on package closure size (by running nix path-info -S before and after)
[ ] Ensured that relevant documentation is up to date
[ ] Fits CONTRIBUTING.md.

Notify maintainers
cc @

@pasqui23 Are you still working on this?

No,if I redid this it would be on a different branch to recapture the new versions


TSServer exited. Code: null. Signal: SIGTERM. Nothing useful in the logs.

Bug Report
My TSServer keeps crashing.
🔎 Search Terms
I've been googling for 3 hours now things like:

TSServer exited. Code: null. Signal: SIGTERM
VSCode intellisense not working
TS Server crashes
Typescript Partial Mode

🕗 Version & Regression Information
About 2 months ago in January 2023.
I have checked:  https://github.com/Microsoft/TypeScript/wiki/FAQ#common-bugs-that-arent-bugs
There's nothing in there.
I am unable to install: typescript@next because npm goes into an infinite loop when trying to --force install it.

This is a crash of Typescript Server
This changed between versions (doesn't matter). Tried 4.7.0, 4.8.4 and 4.9.4
This is the behavior in every version I tried, and I reviewed the FAQ for entries about TS Server crash.

I don't have any extensions in my workspace in VSCode that would be conflicting. Not sure where to turn.
⏯ Playground Link
Cannot narrow it down to a "playground" code.
💻 Code
N/A
But here's what I see in the logs:
Typescript Extension Logs:
[Info - 20:05:49.788] Starting TS Server
[Info - 20:05:49.788] Using tsserver from: /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js
[Info - 20:05:49.790] <syntax> Log file: /Users/atrofimov/Library/Application Support/Code/logs/20230307T111556/window1/exthost/vscode.typescript-language-features/tsserver-log-6TnEWJ/tsserver.log
[Info - 20:05:49.790] <syntax> Forking...
[Info - 20:05:49.792] <syntax> Starting...
[Error - 20:05:49.799] TSServer exited. Code: null. Signal: SIGTERM

Typescript Server Logs attached.
serverlog.txt
🙁 Actual behavior
The typescript server crashes very soon after starting.
🙂 Expected behavior
I expect it to not crash.

Is this for all folders, or for a certain project?

This was for all of the folders within my project. I did get it to work by
reinstalling vscode, reinstalling dependencies and creating a new workspace
in a different folder. :shrug:
On Tue, Mar 7, 2023 at 2:51 PM Ryan Cavanaugh @.***>
wrote:

Is this for all folders, or for a certain project?
—
Reply to this email directly, view it on GitHub
https://github.com/microsoft/TypeScript/issues/53147#issuecomment-1458989281,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAM5VCY2BNHTYYABI3B5KI3W263XNANCNFSM6AAAAAAVS6B7KU
.
You are receiving this because you authored the thread.Message ID:
@.***>

Uh, hmm. We'll need some way to reproduce this for sure then

I'll make a new issue when I encounter it again. A lot of my coworkers get the same issue sporadically. So it's probably something about our workspace.