OfficeDev / Microsoft-365-Copilot-Samples

Microsoft Copilot for Microsoft 365 samples
https://aka.ms/extendcopilotm365
MIT License
130 stars 82 forks source link

[Bug]: AxiosError: Request failed with status code 403 #179

Closed zedhaque closed 2 months ago

zedhaque commented 2 months ago

Sample

msgext-doc-search-js

Description

Hi,

I have managed to build and run the sample (see screenshot). However, as you can see, I am not getting any results, only a server error (this is from the VS Code terminal on Mac OS). My app gets created in the developer portal, but just to confirm — I intentionally did not log in to my Azure account as I am trying this out locally. I have logged into my production M365 account, and custom app sharing is enabled. Also, I have a Copilot license. I must be missing something. Please see the screenshot. In the "developer info" section, the plugin did get called but doesn't provide any further debug messages.

 [onTurnError] unhandled error: AxiosError: Request failed with status code 403
RestError: Unknown 
 {
  "name": "RestError",
  "code": "ServiceError",
  "statusCode": 400,
  "request": {
    "streamResponseStatusCodes": {},
    "url": "https://smba.trafficmanager.net/au/v3/conversations/29%3A1fXWVE12-rsRtPZB_B0cPW27U09aujXou7Dgww6qgOpDX0PVh_is3moH_4e3XHX_9ETsNm74wAutgRoKdkMujjA/activities/f%3A42ac8eb3-2953-521c-e919-5a85f512e612",
    "method": "POST",
    "headers": {
      "_headersMap": {
        "content-type": "application/json; charset=utf-8",
        "x-ms-conversation-id": "REDACTED",
        "accept": "*/*",
        "user-agent": "Microsoft-BotFramework/3.1 botframework-connector/4.23.0 core-http/3.0.4 Node/v18.14.0 OS/(arm64-Darwin-23.6.0)",
        "authorization": "REDACTED"
      }
    },
    "withCredentials": false,
    "timeout": 0,
    "requestId": "8cdfe9d0-61f0-4748-a1f1-9beb642bd7fa"
  },
  "details": {
    "error": {
      "code": "ServiceError",
      "message": "Unknown"
    }
  },
  "message": "Unknown"
}
Screenshot 2024-09-14 at 10 22 12 AM

Teams screenshot

Screenshot 2024-09-14 at 10 24 18 AM

Copilot developer screenshot.

Steps to reproduce

Followed readme instructions as per GitHub repo. Local F5 debug Add app

Expected results

Working app with copilot chat capabilities.

Actual results

See attached screenshot.

Additional Info

No response

zedhaque commented 2 months ago

Additionally, I am the admin in the M365 tenant.

zedhaque commented 2 months ago

Azure OpenAI was enabled for Managed Identity only. Once I enabled API access all is working.