BotFramework-Composer: Internal Server Error 500 from Web Chat, probably firewall issue

Describe the bug

After clicking “Open Web Chat” with standard “Empty Bot” template (and others), I get in Electron:

[11:14:41 AM]POST201/v3/conversations
[11:14:42 AM]POST500/v3/directline/conversations/c0e7bb7d-eff9-41d1-aa9b-de837ec4cea6%7Clivechat/activities
An error occurred posting activity to the bot. Internal Server Error

in Chrome/Firefox

POST http://localhost:5001/v3/directline/conversations/daac9a83-2eae-4c6c-9d7d-f54a3bec4d89%7Clivechat/activities 500 (Internal Server Error) 

and in the console with DEBUG=composer'*':

GET /api/publish/14829.393574961314/status/default/37648115-d7a3-4071-977e-f4ce37fd1a4d 200 37.735 ms - 84
  composer:bot-project Schemas directory found. +396ms
  composer:bot-project Customized SDK schema found +2ms
  composer:bot-project UI Schema found. +2ms
PUT /api/projects/14829.393574961314/files/appsettings.json 200 40.403 ms - 34
POST /v3/conversations 201 0.582 ms - 302
  composer:extensions:localpublish:17974 fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1]
      An unhandled exception has occurred while executing the request.
Microsoft.Bot.Schema.ErrorResponseException: Operation returned an invalid status code 'Forbidden'
   at Microsoft.Bot.Connector.Conversations.ReplyToActivityWithHttpMessagesAsync(String conversationId, String activityId, Activity activity, Dictionary`2 customHeaders, CancellationToken cancellationToken)
   at Microsoft.Bot.Connector.ConversationsExtensions.ReplyToActivityAsync(IConversations operations, String conversationId, String activityId, Activity activity, CancellationToken cancellationToken)
   at Microsoft.Bot.Builder.CloudAdapterBase.SendActivitiesAsync(ITurnContext turnContext, Activity[] activities, CancellationToken cancellationToken)
   at Microsoft.Bot.Builder.TurnContext.<>c__DisplayClass31_0.<<SendActivitiesAsync>g__SendActivitiesThroughAdapter|1>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.Bot.Builder.SetSpeakMiddleware.<>c__DisplayClass3_0.<<OnTurnAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.Bot.Builder.TurnContext.SendActivityAsync(IActivity activity, CancellationToken cancellationToken)
   at Microsoft.Bot.Builder.TurnContext.SendActivityAsync(String textReplyToSend, String speak, String inputHint, CancellationToken cancellationToken)
   at Microsoft.Bot.Builder.Dialogs.Adaptive.Runtime.CoreBotAdapter.<.ctor>b__0_0(ITurnContext turnContext, Exception exception)
   at Microsoft.Bot.Builder.BotAdapter.RunPipelineAsync(ITurnContext turnContext, BotCallbackHandler callback, CancellationToken cancellationToken)
   at Microsoft.Bot.Builder.CloudAdapterBase.ProcessActivityAsync(AuthenticateRequestResult authenticateRequestResult, Activity activity, BotCallbackHandler callback, CancellationToken cancellationToken)
   at Microsoft.Bot.Builder.CloudAdapterBase.ProcessActivityAsync(String authHeader, Activity activity, BotCallbackHandler callback, CancellationToken cancellationToken)
   at Microsoft.Bot.Builder.Integration.AspNet.Core.CloudAdapter.ProcessAsync(HttpRequest httpRequest, HttpResponse httpResponse, IBot bot, CancellationToken cancellationToken)
   at Empty_2.Controllers.BotController.PostAsync(String route) in /Users/s.buchholz/BotFrameworkComposer/Empty_2/Empty_2/Controllers/BotController.cs:line 67
   at lambda_method(Closure , Object )
   at Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
 +7s
POST /v3/directline/conversations/58fa9f2e-d3fc-4b8c-b372-4e455a12e426|livechat/activities 500 988.940 ms - 105

Version

Version: 2.1.1 Electron: 8.2.4 Chrome: 80.0.3987.165 NodeJS: 12.13.0 V8: 8.0.426.27-electron.0

Browser

  • Electron distribution
  • Chrome
  • Safari
  • Firefox
  • Edge

OS

  • macOS Monterey 12.0.1 (x86)
  • Windows
  • Ubuntu

To Reproduce

Steps to reproduce the behavior:

  1. Go to ‘Home’ “Welcome to Bot Framework Composer”
  2. Click on ‘Create New’
  3. Use default C# “Empty Bot” template
  4. Click on “Next”
  5. Click on “Create”
  6. Click on “Start bot”
  7. Click on “Open Web Chat”

Expected behavior

Bot should have said “Welcome to your bot”

Screenshots

image

Additional context

I had existing bots which all used to work and now show the same error. I think the problem started after upgrading from MacOS Catalina to Monterey. All bots still work in the Emulator. Have updated node.js and .NET versions, made no difference. I notice someone else’s (working!) bot on MacOS Catalina is using localhost:5000 instead of localhost:5001 out of the box. Not sure whether that’s relevant…

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 27 (5 by maintainers)

Most upvoted comments

Not sure about the versioning problem mentioned later in the thread, however, I was having the same problem on MacOS and I solved it by turning off “AirPlay Receiver” in Settings->Sharing. After restarting Composer, the app started using port 5000 as expected (before it was using 5001). Aside from the libs versioning problem, it would be nice if Composer worked with dynamic ports, and avoid conflicts with specific OS ports, e.g. detect which port is in use rather than assume it’s 5000.

Yep, downgrading Orchestrator to 4.14.4 fixes the root bot.

We’ve seen a similar issue with other packages. Can’t Composer account for this in some much more sane way?

Not sure about the versioning problem mentioned later in the thread, however, I was having the same problem on MacOS and I solved it by turning off “AirPlay Receiver” in Settings->Sharing. After restarting Composer, the app started using port 5000 as expected (before it was using 5001). Aside from the libs versioning problem, it would be nice if Composer worked with dynamic ports, and avoid conflicts with specific OS ports, e.g. detect which port is in use rather than assume it’s 5000.

Struggling with the same problem on MacOS - and @dluc’s suggestion worked for me (thanks!).