ryanvolum / offline-directline

Unofficial package to emulate the bot framework connector locally.
https://www.npmjs.com/package/offline-directline
78 stars 44 forks source link

No response after conversation creation #2

Open codingcronus opened 7 years ago

codingcronus commented 7 years ago

Hi, thank you for a great library :-)

I'm running into an issue. I have:

1) A custom WebChat component from https://github.com/Microsoft/BotFramework-WebChat running on port 8000. 2) A .NET Bot Webservice running on port 3979 3) Your sample where I have just changed 3978 to 3979

When re-loading the WebChat component, I can see that your service creates a new conversation id with a random guid. When sending a message via the WebChat, I can see via Fiddler that the message is correctly posted to your service (the activities endpoint), but it never responds and eventually times out.

I have also tried to replace my .NET Bot Webservice with a very simple Node.js Bot Webservice (the one from https://docs.microsoft.com/en-us/bot-framework/nodejs/bot-builder-nodejs-quickstart). I can see that your service correctly post the message to the web service, but then I get the following error: "ERROR: ChatConnector: receive - no security token sent.". In the BotBuilder SDKs ChatConnector I edited the code to skip the token check:

ChatConnector.prototype.verifyBotFramework = function (req, res) {
   var _this = this;
   _this.dispatch(req.body, res);

   return;
}

And then the Bot Webservice (Node.js) replies correctly. This leads me to think that it's a security issue and since I do not have the source code for .NET BotBuilder SDK, I cannot skip the token verification, which means that I cannot use my .NET Bot Webservice and instead have to rewrite it to Node.js...

I hope you can help me :-)

ryanvolum commented 7 years ago

Sorry you're having issues @tigerdyret! This sample actually takes all messages and gives them a channelId of "emulator" which should be skipping any token checking. That said, I haven't tested the package with a C# bot, so I'll see if I can get one working.

Did you change the websockets variable (in your directline instantiation in your webchat project) to false? Also, are you running the offline connector via the npm script command or through code?

codingcronus commented 7 years ago

Hi @ryanvolum Thank you. Yes, I did change the websockets setting to false, so I guess that's not the issue here. Did you get a chance to test using a C# based bot? :-)

ryanvolum commented 7 years ago

I have and it seems to be working for me! I just tested on the Echo Bot sample (crazy simple) and just had to update the hostname I passed into initializeRoutes to reflect the project I was hosting on. Sorry you're still having trouble - can you try with the EchoBot (in case your bot is somehow doing something above and beyond)?

Matti-Koopa commented 7 years ago

I'm having the same problem. The node output says "Created conversion with conversationId: xxx" but the breakpoint in "Post" or "HandleSystemMessage" in the running debugging C# project never get's hit.

Matti-Koopa commented 7 years ago

Fixed it: Apparently you HAVE to specify a BotId in web.config. <add key="BotId" value="aaa" /> Add this to your WebChat like: http://localhost:3978/BotFramework-WebChat/samples/fullwindow/index.html?domain=http://localhost:3000/directline&botid=aaa

Still doesn't send system message though. The original emulator sends an initial "ConversationUpdate" message. This one doesn't. My message get's stuck at await Conversation.SendAsync(activity, () => new RootDialog()); and never even reaches the constructor of RootDialog.

rainmakerho commented 7 years ago

I use c# echo bot project. i got Autofac.Core.Resolving.ResolveOperation.Execute Error below, Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable1 parameters) Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable1 parameters) Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable1 parameters, Object& instance) Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable1 parameters) Autofac.ResolutionExtensions.Resolve[TService](IComponentContext context, IEnumerable`1 parameters) Autofac.ResolutionExtensions.Resolve[TService](IComponentContext context) Microsoft.Bot.Builder.Dialogs.Conversation.d__11.MoveNext()

I use node echo bot project. The webchat won't get bot's echo message. Created conversation with conversationId: 7b8f1802-2bc6-4950-a7ad-2f900d1e81d4 Called GET user data Data key: $emulator!!userid Called GET private conversation data Data key: $emulator!7b8f1802-2bc6-4950-a7ad-2f900d1e81d4!userid Called GET conversation data Data key: $emulator!7b8f1802-2bc6-4950-a7ad-2f900d1e81d4!

Fiddler tool got 404 code from OPTIONS http://localhost:3000/directline/conversations/7b8f1802-2bc6-4950-a7ad-2f900d1e81d4?watermark=

b4usat commented 7 years ago

@ryanvolum Message is properly delivered to the bot but could able to retrieve the response. Not sure how it will work. Can you please guide me? capture

ryanvolum commented 6 years ago

Apologies for not keeping up with this. It seems that the C# SDK is making an OPTIONS call against /directline/conversations/:conversationId which the Node SDK is not. The resolution should be to create a new route in bridge.ts for app.options. I'll investigate further if I have the chance

Matti-Koopa commented 6 years ago

Is there any update on this?

pradeepdeepu commented 5 years ago

Hi Ryanvolum,

As you mentioned in C# SDK there is a call the URL : http://127.0.0.1:3000/directline/conversations. I'm badly in need of this fix. Let me know if there is a fix for this.