Exception when sending messages in short intervals to LuisDialog
Some internals crash when sending messages in fast succession to a LuisDialog.
I tried it with an "empty" LuisDialog. Works fine when the messages are send with some time inbetween. (copying a sentence and doing crtl + v --> enter 4 times in a row always triggers this error at least once in all my tests)
public class TestDialog : LuisDialog<object>
{
[LuisIntent("")]
public async Task None(IDialogContext context, LuisResult result)
{
context.Wait(MessageReceived);
}
}
I think the Bot might have problems with messing up the bot state and can't persist it properly.
Full exception: http://pastebin.com/fX3JcQ6F
Here is some more information about 412/409:
https://docs.botframework.com/en-us/technical-faq/#what-causes-precondition-failed-412-or-conflict-409-http-errors https://docs.botframework.com/en-us/technical-faq/#how-can-i-fix-precondition-failed-412-or-conflict-409-http-errors
and here is some more background:
https://docs.botframework.com/en-us/technical-faq/#where-is-conversation-state-stored https://docs.botframework.com/en-us/technical-faq/#what-is-an-etag--how-does-it-relate-to-bot-data-bag-storage
I'm happy to answer further questions.
Okay, interesting to know that C# and Node take different approaches. Changing my C# code to use the Node way works fine for me.
Sorry for missing that part of the docu and opening an issue...
@ThisWillDoIt we're happy to talk to users through the issues - sometimes we point to documentation to save time with some text that has been edited/refined/improved over time rather than answer "off the cuff".
@willportnoy where should I put the code to avoid "412" errors, the one that is here: https://docs.botframework.com/en-us/technical-faq/#how-can-i-fix-precondition-failed-412-or-conflict-409-http-errors, in the messageController?
@fercom anywhere that executes just once, since you're updating the static container.
Perhaps a static constructor for MessagesController, or Global.asax.cs, or wherever you configure your container.
Relevant at some point: https://github.com/Microsoft/BotBuilder/issues/1966
@willportnoy I put it in global.asax.cs, but my bot is still throwing "412's"
protected void Application_Start()
{
var builder = new ContainerBuilder();
builder
.Register(c => new CachingBotDataStore(c.Resolve<ConnectorStore>(), CachingBotDataStoreConsistencyPolicy.LastWriteWins))
.As<IBotDataStore<BotData>>()
.AsSelf()
.InstancePerLifetimeScope();
builder.Update(Conversation.Container);
GlobalConfiguration.Configure(WebApiConfig.Register);
}
@willportnoy I put it in a static constructor for MessageController, it seems that the "412"s are gone but now it is throwing 400's and 403's

@fercom I would open a new top level issue for that. 400 is a 'bad request" and 403 is "authorization failed", so it seems likely they are caused by other issues.
@willportnoy it seems that the code used to solve this problem doesn't work anymore with version 3.5.1 of the bot builder. it says: The requested service 'Microsoft.Bot.Builder.Dialogs.Internals.ConnectorStore' has not been registered. To avoid this exception, either register a component to provide the service, check for service registration using IsRegistered(), or use the ResolveOptional() method to resolve an optional dependency.
Just to let you know that this is still an issue after updating to 3.5.3
@fercom I'd open a top level issue for your question because we don't look at closed issues.
In your case, the ConnectorStore is registered differently now, but it's IBotDataStore interface:
https://github.com/Microsoft/BotBuilder/blob/master/CSharp/Library/Microsoft.Bot.Builder.Autofac/Dialogs/DialogModule.cs#L140
@willportnoy ok, it is here: https://github.com/Microsoft/BotBuilder/issues/2345