bing-chat icon indicating copy to clipboard operation
bing-chat copied to clipboard

Error: unexpected HTTP error createConversation 503: Service Unavailable

Open RaschidJFR opened this issue 1 year ago • 0 comments

When trying to run any of the demos I get this error:

(base) raschidjfr@MacBook-Pro-de-Raschid bing-chat % npx tsx demos/demo
✖ What are today’s top stories in the United States?
Error: unexpected HTTP error createConversation 503: Service Unavailable
    at <anonymous> (/Users/raschidjfr/Documents/git/bing-chat/src/bing-chat.ts:317:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at BingChat.sendMessage (/Users/raschidjfr/Documents/git/bing-chat/src/bing-chat.ts:65:28)
    at async oraPromise (file:///Users/raschidjfr/Documents/git/bing-chat/node_modules/ora/index.js:397:18)
    at main (/Users/raschidjfr/Documents/git/bing-chat/demos/demo.ts:20:15)

The error is traced back to this block. Removing the cookie from the headers seems to fix the problem:

return fetch('https://www.bing.com/turing/conversation/create', {
      headers: {
        accept: 'application/json',
        'accept-language': 'en-US,en;q=0.9',
        'content-type': 'application/json',
        'sec-ch-ua':
          '"Not_A Brand";v="99", "Microsoft Edge";v="109", "Chromium";v="109"',
        'sec-ch-ua-arch': '"x86"',
        'sec-ch-ua-bitness': '"64"',
        'sec-ch-ua-full-version': '"109.0.1518.78"',
        'sec-ch-ua-full-version-list':
          '"Not_A Brand";v="99.0.0.0", "Microsoft Edge";v="109.0.1518.78", "Chromium";v="109.0.5414.120"',
        'sec-ch-ua-mobile': '?0',
        'sec-ch-ua-model': '',
        'sec-ch-ua-platform': '"macOS"',
        'sec-ch-ua-platform-version': '"12.6.0"',
        'sec-fetch-dest': 'empty',
        'sec-fetch-mode': 'cors',
        'sec-fetch-site': 'same-origin',
        'x-edge-shopping-flag': '1',
        'x-ms-client-request-id': requestId,
        'x-ms-useragent':
          'azsdk-js-api-client-factory/1.0.0-beta.1 core-rest-pipeline/1.10.0 OS/MacIntel',
        // cookie    <- Removing this line fixes the problem
      },
      referrer: 'https://www.bing.com/search',
      referrerPolicy: 'origin-when-cross-origin',
      body: null,
      method: 'GET',
      mode: 'cors',
      credentials: 'include'
    })

RaschidJFR avatar Jun 15 '23 02:06 RaschidJFR