microsoft / BotFramework-WebChat

A highly-customizable web-based client for Azure Bot Services.
https://www.botframework.com/
MIT License
1.59k stars 1.54k forks source link

Getting 403 from https://directline.botframework.com/v3/directline/tokens/generate #4944

Closed OlcayGoeren closed 10 months ago

OlcayGoeren commented 11 months ago

I have a question

Issue Description

Hello,

I've encountered an issue where https://directline.botframework.com/v3/directline/tokens/generate is not accessible through my web server, while it works as expected when accessed via localhost. I am wondering if there's a need to configure domain settings on Azure, or if there might be another underlying issue causing this behavior.

Steps to Reproduce

  1. Deploy the web server on Vercel.
  2. Attempt to access the given URL.
  3. Observe that the URL is not accessible, resulting in a 403.

However, when I run the web server locally using localhost, the URL is accessible and the page/content loads without any issues.

Expected Behavior

The URL should be accessible through the Webserver just as it is when accessed via localhost.

Actual Behavior

The URL is not accessible through the Vercel deployment; however, it works on localhost.

Error:

"error": {
    "message": "Request failed with status code 403",
    "name": "AxiosError",
    "stack": "AxiosError: Request failed with status code 403\n    at settle (/var/task/.next/server/chunks/787.js:1:42835)\n    at IncomingMessage.<anonymous> (/var/task/.next/server/chunks/787.js:3:8535)\n    at IncomingMessage.emit (node:events:529:35)\n    at endReadableNT (node:internal/streams/readable:1368:12)\n    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)",
    "config": {
      "transitional": {
        "silentJSONParsing": true,
        "forcedJSONParsing": true,
        "clarifyTimeoutError": false
      },
      "adapter": [
        "xhr",
        "http"
      ],
      "transformRequest": [
        null
      ],
      "transformResponse": [
        null
      ],
      "timeout": 0,
      "xsrfCookieName": "XSRF-TOKEN",
      "xsrfHeaderName": "X-XSRF-TOKEN",
      "maxContentLength": -1,
      "maxBodyLength": -1,
      "env": {

      },
      "headers": {
        "Accept": "application/json, text/plain, */*",
        "Content-Type": "application/json",
        "Authorization": "Bearer <WEBCHAT_SECRET>",
        "User-Agent": "axios/1.6.0",
        "Content-Length": "2",
        "Accept-Encoding": "gzip, compress, deflate, br"
      },
      "method": "post",
      "url": "https://directline.botframework.com/v3/directline/tokens/generate",
      "data": "{}"
    },
    "code": "ERR_BAD_REQUEST",
    "status": 403
  },

Possible Solutions/Questions

Any insights or guidance on resolving this issue would be greatly appreciated!

Thank you!

dmvtech commented 11 months ago

There should not be anything needed to configure in Azure. This seems to be more of an issue with Vercel. Although, everything that I can see above (minus the secret itself) looks correct.

I am able to make a call successfully, from many different locations (though I haven't tried from within Vercel).