microsoft / BotFramework-DirectLineJS

JavaScript client library for Microsoft Bot Framework's Direct Line protocol
MIT License
195 stars 127 forks source link

Error with Power Virtual Agent: Site Missing code 403 from https://directline.botframework.com/v3/directline/conversations #387

Closed alessiodecastro closed 1 year ago

alessiodecastro commented 1 year ago

Hi the following piece of code was working fine up to last week, from today we are getting the following 403 error after successfully retrieve the token and when performing request to: https://directline.botframework.com/v3/directline/conversations

response body:

"error": {
    "code": "BadArgument",
    "message": "Site missing. Learn more about sites  https://docs.microsoft.com/azure/bot-service/bot-service-channel-connect-directline?view=azure-bot-service-4.0#add-new-site."
  }

image

Here is the full test code:

`

<!DOCTYPE html>
<html lang="en-US">
  <head>
    <title>Web Chat</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <script crossorigin="anonymous" src="https://cdn.botframework.com/botframework-webchat/latest/webchat.js"></script>
    <style>
      html,
      body {
        height: 100%;
      }

      body {
        margin: 0;
      }

      #webchat {
        height: 100%;
        width: 100%;
      }
    </style>
  </head>
  <body>
    <div id="webchat" role="main"></div>
    <script>
      (async function() {
        const res = await fetch('https://ced36af1b92ee6ae99db50a8734a78.5a.environment.api.powerplatform.com/powervirtualagents/bots/b8ab704c-8d06-417e-b2b5-fc65a0abf77f/directline/token?api-version=2022-03-01-preview', { method: 'GET' });
        const { token } = await res.json();

        window.WebChat.renderWebChat(
          {
            directLine: window.WebChat.createDirectLine({ token })
          },
          document.getElementById('webchat')
        );

        document.querySelector('#webchat > *').focus();
      })().catch(err => console.error(err));
    </script>
  </body>
</html>

`

stevkan commented 1 year ago

Duplicate of Botframework-WebChat issue 4625.