Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property 'subscribe' of undefined #48

Open
simon-tannai opened this issue Sep 13, 2019 · 0 comments
Open

TypeError: Cannot read property 'subscribe' of undefined #48

simon-tannai opened this issue Sep 13, 2019 · 0 comments

Comments

@simon-tannai
Copy link

simon-tannai commented Sep 13, 2019

Hello ! :)

I'm trying to use Offline Directline with Docker.
My bot and the Offline Directline are running fine, but from the Webchat, I got this error:
TypeError: Cannot read property 'subscribe' of undefined.

Here my simple HTML webchat's page:

<!DOCTYPE html>
<html>
   <body>
      <div id="webchat" role="main"></div>
      <script src="https://cdn.botframework.com/botframework-webchat/latest/webchat.js"></script>
      <script>
         (async () => {
            const userId = 'dl_123'
            const secret = 'MY_SECRET'

            const rawResponse = await fetch('https://directline.botframework.com/v3/directline/tokens/generate', {
               method: 'POST',
               headers: {
                  'Accept': 'application/json',
                  'Content-Type': 'application/json',
                  'Authorization': 'Bearer ' + secret
               },
               body: JSON.stringify({
                  User: { Id: userId }
               })
            });

            const content = await rawResponse.json();

            window.WebChat.renderWebChat(
               {
                  // directLine: window.WebChat.createDirectLine({
                  //    token: content.token
                  // }),
                  directLine: {
                     secret,
                     token: content.token,
                     domain: 'http://127.0.0.1:3000/directline',
                     webSocket: false,
                  },
                  userID: userId,
                  username: 'testuser',
                  locale: 'en-US',
                  botAvatarInitials: 'WC',
                  userAvatarInitials: 'WW'
               },
               document.getElementById('webchat')
            );

            console.info(`Webchat initialized with token ${content.token}`)
         })();
      </script>
   </body>
</html>

From Postman, an HTTP request OPTION 127.0.0.1:3000/directline returns a 200 status code.

Did I missed something on Webchat configuration ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant