Can't use TelemetryTrackEvent actions
See original GitHub issueDescribe the bug
I have a super simple echo bot (fresh out of the template) with an extra action to send a custom telemetry event to application insights with the input from the user, however it doesn’t work. When trying the bot in the emulator I get a 500 error, and when running the project without the composer I get the following message:
`fail: Microsoft.AspNetCore.Server.Kestrel[13] Connection id “0HM35SOKSNO2T”, Request id “0HM35SOKSNO2T:00000001”: An unhandled exception was thrown by the application. System.Exception: echobot-1.dialog error: Type Microsoft.TelemetryTrackEvent not registered in factory.
at Microsoft.Bot.Builder.Dialogs.Declarative.Resources.ResourceExplorer.LoadTypeAsync[T](Resource resource, CancellationToken cancellationToken) at Microsoft.Bot.Builder.Dialogs.Declarative.Resources.ResourceExplorer.LoadType[T](Resource resource) at Microsoft.BotFramework.Composer.Core.ComposerBot.LoadRootDialogAsync() in /Users/rafael.quesada/Projects/bot_builder_template_tests/EchoBot-1/runtime/core/ComposerBot.cs:line 69 at Microsoft.BotFramework.Composer.Core.ComposerBot…ctor(ConversationState conversationState, UserState userState, ResourceExplorer resourceExplorer, BotFrameworkClient skillClient, SkillConversationIdFactoryBase conversationIdFactory, IBotTelemetryClient telemetryClient, String rootDialog, String defaultLocale, Boolean removeRecipientMention) in /Users/rafael.quesada/Projects/bot_builder_template_tests/EchoBot-1/runtime/core/ComposerBot.cs:line 43 at Microsoft.BotFramework.Composer.WebAppTemplates.Startup.<>c__DisplayClass12_0.b__4(IServiceProvider s) in /Users/rafael.quesada/Projects/bot_builder_template_tests/EchoBot-1/runtime/azurewebapp/Startup.cs:line 187 at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSiteMain(ServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitCache(ServiceCallSite callSite, RuntimeResolverContext context, ServiceProviderEngineScope serviceProviderEngine, RuntimeResolverLock lockType) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite singletonCallSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(ServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.b__0(ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType) at Microsoft.Extensions.DependencyInjection.ActivatorUtilities.GetService(IServiceProvider sp, Type type, Type requiredBy, Boolean isDefaultParameterRequired) at lambda_method(Closure , IServiceProvider , Object[] ) at Microsoft.AspNetCore.Mvc.Controllers.ControllerActivatorProvider.<>c__DisplayClass4_0.b__0(ControllerContext controllerContext) at Microsoft.AspNetCore.Mvc.Controllers.ControllerFactoryProvider.<>c__DisplayClass5_0.g__CreateController|0(ControllerContext controllerContext) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync() — End of stack trace from previous location where exception was thrown — at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Logged|17_1(ResourceInvoker invoker) at Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger) at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication1 application)`
I haven’t done any customizations to the runtime and the docs don’t point to anything I might be doing wrong, am I missing something here? I should mention that I do receive other traces in app insights, so it seems to be properly configured.
Version
1.1.1
Browser
- Electron distribution
- Chrome
- Safari
- Firefox
- Edge
OS
- macOS
- Windows
- Ubuntu
To Reproduce
Steps to reproduce the behavior:
- Create a new bot with the echo bot template
- Add a new action in the Unknown intent trigger after the bot response with property “input” and value “=turn.activity.text”
- Start the bot and try it out in the emulator, should receive an error 500
Expected behavior
When using a custom telemetry event, it should be sent to application insights and appear when querying the logs.
Screenshots
- Composer:
- Emulator:
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (5 by maintainers)
Top GitHub Comments
Thanks @luhan2017, works like a charm!
This is because the schema and code mismatch. In schema, the action is called “TelemetryTrackEvent”, but in code it is declared as “TelemetryTrackEventAction”, I will submit a PR in the sdk side to fix this issue.
You are mitigate this issue by update your dialog file. @RafaelQuesada Click show code, and replace “$kind”: “Microsoft.TelemetryTrackEvent” with “$kind”: “Microsoft.TelemetryTrackEventAction”, then Restart your bot, it will work.
@cwhitten @garypretty,I will submit a PR to fix this in the sdk side.