SharePoint / sp-dev-docs

SharePoint & Viva Connections Developer Documentation
https://docs.microsoft.com/en-us/sharepoint/dev/
Creative Commons Attribution 4.0 International
1.25k stars 1.01k forks source link

Intermittent "unknown" errors from /_api/search/postquery #8639

Open IvanTheBearable opened 1 year ago

IvanTheBearable commented 1 year ago

Target SharePoint environment

SharePoint Online

What SharePoint development model, framework, SDK or API is this about?

SharePoint REST API

Developer environment

None

What browser(s) / client(s) have you tested

Additional environment details

Describe the bug / error

PostQuery requests sent by the PnP Modern Search web parts are returning intermittent 500 responses with a message "An unknown error occurred". Exactly the same request will work one time and then, a few minutes later, fail. This suggest, to me, that the issue is with the API.

I have seen the error on several tenants over recent months but it has always been very rare so hasn't had much investigation. It has recently started happening much more frequently on one particular tenant. I have yet to identify any pattern or reason for that.

As with most intermittent issues, there is not much to go on here. I will add more information as I find it, and hopefully other people experiencing the same issue may be able to add useful details.

Steps to reproduce

Here is an example request:

{
  "request": {
    "__metadata": {
      "type": "Microsoft.Office.Server.Search.REST.SearchRequest"
    },
    "ClientType": "PnPModernSearch",
    "Properties": {
      "results": [
        {
          "Name": "EnableDynamicGroups",
          "Value": {
            "BoolVal": true,
            "QueryPropertyValueTypeIndex": 3
          }
        },
        {
          "Name": "EnableMultiGeoSearch",
          "Value": {
            "BoolVal": true,
            "QueryPropertyValueTypeIndex": 3
          }
        },
        {
          "Name": "ClientFunction",
          "Value": {
            "StrVal": "PnPSearchWebPart",
            "QueryPropertyValueTypeIndex": 1
          }
        },
        {
          "Name": "ListId",
          "Value": {
            "StrVal": "38f10ba0-bb22-46d0-818c-970a482f839a",
            "QueryPropertyValueTypeIndex": 1
          }
        },
        {
          "Name": "ListItemId",
          "Value": {
            "StrVal": "2",
            "QueryPropertyValueTypeIndex": 1
          }
        }
      ]
    },
    "Querytext": "12345 OR 67890",
    "EnableQueryRules": false,
    "QueryTemplate": "PPR:(12345 OR 67890)",
    "SourceId": "7e421198-188a-43a1-a027-7f97180a8c4d",
    "EnableNicknames": false,
    "EnablePhonetic": false,
    "Culture": 1033,
    "TimeZoneId": 17,
    "Refiners": "",
    "RefinementFilters": {
      "results": []
    },
    "RowLimit": 10,
    "StartRow": 0,
    "TrimDuplicates": false,
    "SortList": {
      "results": [
        {
          "Property": "RefinableString116",
          "Direction": 0
        },
        {
          "Property": "Address",
          "Direction": 0
        },
        {
          "Property": "RefinableString113",
          "Direction": 0
        }
      ]
    },
    "SelectProperties": {
      "results": [
        "Address",
        "LegalDescription",
        "ListItemID",
        "PRAType",
        "RefinableDecimal00",
        "RefinableString113",
        "RefinableString114",
        "RefinableString115",
        "RefinableString116",
        "RefinableString117"
      ]
    },
    "HitHighlightedProperties": {
      "results": []
    },
    "ReorderingRules": {
      "results": []
    }
  }
}

This example was constructed and sent by the PnP Modern Search web part to a /_api/search/postquery endpoint. In this example, the web part has a search template of PPR:({searchTerms}) and a query string of 12345 OR 67890.

Expected behavior

Expect the same results on each request.

ghost commented 1 year ago

Thank you for reporting this issue. We will be triaging your incoming issue as soon as possible.

ILAaronL commented 1 year ago

Hi there.

We are continuing to experience this issue in a number of tenants. Please let me know if there is any additional information we can provide about the issue.

Some notes are

JoeAyre commented 1 year ago

Hi,

I'm also experiencing this issue. [HTTP]:500 - [CorrelationId]:82cbcba0-0039-2000-7a76-8e711f340cc8 [Version]:16.0.0.23912

The strange thing in my scenario is that it is only occurring for one user (may be more, but we've tested with many other accounts and these all seem fine). The account that has the issue is the account that created the pages that the Search Results web part is on.

And perhaps even stranger, it isn't occuring on all pages. Some pages the search results web part present continue to work fine.

I've created a new page and added a search box and search results web part to it and the same error occurs. One thing I have noticed is that changing the 'Result Source Id / Scope|Name' configuration clears the error, but as soon as I pick LocalSharePointResults again, the error returns.

I'm sure the details above aren't particularly helpful on their own but may provide some clues to help with diagnosing the issue.

The version I am using is 4.5.4 I can also confirm that v3 seems fine.

Thanks, Joe