Skip to content
This repository has been archived by the owner on Jun 30, 2022. It is now read-only.

VA with connected Skill don't work correctly in WebChat #1530

Closed
higoorc opened this issue Jun 12, 2019 · 20 comments
Closed

VA with connected Skill don't work correctly in WebChat #1530

higoorc opened this issue Jun 12, 2019 · 20 comments
Assignees
Labels
Type: Bug Something isn't working

Comments

@higoorc
Copy link

higoorc commented Jun 12, 2019

My setup is a Virtual Assistant Template connected with a Skill Template. Everything is fine if I try to run my VA inside Bot Emulator, and works correctly in localhost and with Azure Endpoint, but when I try to start a skill dialog in my VA inside Azure WebChat I dont have any response, my VA just stop to answer my questions.

emulator2

emulator1

@higoorc higoorc added the Type: Bug Something isn't working label Jun 12, 2019
@FreddyAyala
Copy link

FreddyAyala commented Jun 12, 2019

I've the exact same problem, I have my main bot and the skill published in azure, when I test the bot inside the emulator it works perfectly fine, the conversation is handed off to the skill bot. However once it is used either in webchat or in my case in a React application using direct-line, the bot just stops responding. The only difference for me between the two configurations it is that we use the AppId and AppPassword in the emulator, maybe there is an authentication problem that prevents two bots from talking to each other when deployed to Azure?

The only information in appinsights is an exception: POST to the bot's endpoint failed with HTTP status 500 no more details than that.

@higoorc higoorc closed this as completed Jun 12, 2019
@higoorc higoorc reopened this Jun 12, 2019
@darrenj
Copy link
Contributor

darrenj commented Jun 12, 2019

Thanks for this - can you confirm that you can browse to the skill manifest endpoint of your deployed skill? e.g. http://YOURSKILLNAME.azurewebsites.net/api/skill/manifest. This will prove that the skill is working correctly.

@higoorc
Copy link
Author

higoorc commented Jun 12, 2019

Thanks for this - can you confirm that you can browse to the skill manifest endpoint of your deployed skill? e.g. http://YOURSKILLNAME.azurewebsites.net/api/skill/manifest. This will prove that the skill is working correctly.

Yep, my manifest is online and seems ok. Also, If I ty to use the webchat inside my skill's resource group it works (just with skill dialogs and without VA, of course). Here my manifest: https://hsilva-my1stskill.azurewebsites.net/api/skill/manifest.

Everything works inside Bot Emulator, using my VA and Skill Azure endpoint, the problem is just inside VA WebChat when try to redirect for the skill.

@darrenj
Copy link
Contributor

darrenj commented Jun 12, 2019

Just double checking the app-service for the Skill was created using the deploy script? Either way can you check Web-Sockets is enabled on the App-Service for the Skill? This is set as part of the skill deployment.

image

@higoorc
Copy link
Author

higoorc commented Jun 12, 2019

Just double checking the app-service for the Skill was created using the deploy script? Either way can you check Web-Sockets is enabled on the App-Service for the Skill? This is set as part of the skill deployment.

Yes, I have websocket enabled in both apps, in my VA and in my Skill app.
And I do all the process following the documentation, with the deploys scripts.

@darrenj
Copy link
Contributor

darrenj commented Jun 12, 2019

Thanks - one last thing to help us repro, can you share the webchat html/js code that your using to "host" the VA bot - minus your secrets of course! Please don't use the webchat control in the Azure page - instead connect webchat channel and test through that approach.

@FreddyAyala
Copy link

FreddyAyala commented Jun 12, 2019

If it helps you, in my case I've also web sockets activated and the manifest is reachable, the react code i've used is:

import React, {Component} from 'react';
import {connect} from 'react-redux';
import { DirectLine } from 'botframework-directlinejs';
import ReactWebChat from 'botframework-webchat';


class HomePage extends Component {
  constructor(props) {
    super(props);

    this.directLine = new DirectLine({ token: '' });
  }
  render() {
    return (
      <div style={{height:'500px'}}>
        <ReactWebChat directLine={ this.directLine } 
                      styleOptions={{}} 
                      locale='fr-FR' 
                      />
      </div>
    );
  }
}

const mapStateToProps = state => ({
  userInfo: state.auth.userInfo,
});

export default connect(mapStateToProps)(HomePage);


@FreddyAyala
Copy link

My manifest: https://dave-skill-jooxter.azurewebsites.net/api/skill/manifest, I'm not using oauth connections.

@higoorc
Copy link
Author

higoorc commented Jun 12, 2019

Thanks - one last thing to help us repro, can you share the webchat html/js code that your using to "host" the VA bot - minus your secrets of course! Please don't use the webchat control in the Azure page - instead connect webchat channel and test through that approach.

Sorry but I dont have a html/js to share because I'm just trying with the Azure WebChat inside the portal. So, not is possible to run in this webchat? I just want to know if I did something wrong or if it's normal.

@FreddyAyala
Copy link

From my side, I've tested a bit more my bot, and it seems that the message from the main bot is handed off to the skill bot however for some reason the main bot doesn't receive the response from the skill bot and this response is not sent to the chat client.

@darrenj
Copy link
Contributor

darrenj commented Jun 12, 2019

Thanks - I've managed to repro in webchat. Odd - investigating.

@darrenj
Copy link
Contributor

darrenj commented Jun 13, 2019

Thanks everyone, I took a look yesterday and @lzc850612 was able to identify an issue oddly only surfacing with webchat where activity responses from skills were not being "rewritten" correctly before sending back to WebChat which was then rejecting.

I've just validated that #1540 fixes the issue with my Bot. Whilst we prepare a new .Skills nuget package you can move forward by taking the latest build from myget and at the same time it's probably wise to take Solutions from myget too as they are built together.

There is a command line example of how to install but you can also add a package source in Visual Studio to: https://botbuilder.myget.org/F/aitemplates/api/v3/index.json

Once you have these versions redeploy your Bot to Azure and try again.

Thanks for your help diagnosing this.

@FreddyAyala
Copy link

@darrenj For me it seems to be working now, great job!

@darrenj
Copy link
Contributor

darrenj commented Jun 13, 2019

Great, thanks for letting us know. We will publish a new build of .solutions and .skills to nuget by the end of the week.

@darrenj darrenj closed this as completed Jun 13, 2019
@higoorc
Copy link
Author

higoorc commented Jun 13, 2019

@darrenj For me when I try to build my skill project I have this error.
'SkillEvents' does not contain a definition for 'SkillBeginEventName', MainDialog.cs, line 128.

@darrenj
Copy link
Contributor

darrenj commented Jun 13, 2019

Delete this handler - the latest Skills package has moved to using SemanticObject (via SkillMiddleware) rather than using a separate event so you don't need to handle this moving forward.

                case SkillEvents.SkillBeginEventName:
                    {
                        var state = await _stateAccessor.GetAsync(dc.Context, () => new SkillState());

                        if (dc.Context.Activity.Value is Dictionary<string, object> userData)
                        {
                            // Capture user data from event if needed
                        }

                        break;
                    }

@higoorc
Copy link
Author

higoorc commented Jun 13, 2019

Delete this handler - the latest Skills package has moved to using SemanticObject (via SkillMiddleware) rather than using a separate event so you don't need to handle this moving forward.

                case SkillEvents.SkillBeginEventName:
                    {
                        var state = await _stateAccessor.GetAsync(dc.Context, () => new SkillState());

                        if (dc.Context.Activity.Value is Dictionary<string, object> userData)
                        {
                            // Capture user data from event if needed
                        }

                        break;
                    }

Thank you, now I deployed again and something new happens. The Assistant didn't wait my response and sent me all turns of the multiturn dialog (also inside Bot Emulator).

emulator3

@darrenj
Copy link
Contributor

darrenj commented Jun 13, 2019

I think it's picked up another change/fix as part of the update. @lzc850612 one to take a look at once you wake up ;-)

@darrenj
Copy link
Contributor

darrenj commented Jun 15, 2019

We have just published new nuget packages to nuget which yo can update to and remove the daily build version. We just some logic which requires a change to your MainDialog.cs in your assistant which I think is the root of the issue you saw above.

Within RouteAsync remove this line

  // Pass the activity we have
  var result = await dc.ContinueDialogAsync();

WebChat works "out of the box" with the new changes.

@lauren-mills lauren-mills removed Status: Committed This has been confirmed for the next release. Status: In Progress This work item in underway. labels Jul 15, 2019
@lauren-mills lauren-mills removed Status: Committed This has been confirmed for the next release. Status: In Progress This work item in underway. Status: Pending Status: Blocked Current progress is blocked labels Jul 15, 2019
@ObsidianDelta
Copy link

Make sure that all your nuget packages are updated ... and skills works with webchat!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants