Error received on request with 400 status code - invalidRequest
"&filter=fields/Task_Id eq {$task->id}"
{"error":{"code":"invalidRequest","message":"Field 'Task_Id' cannot be referenced in filter or orderby as it is not indexed. Provide the 'Prefer: HonorNonIndexedQueriesWarningMayFailRandomly' header to allow this}
===
I would like to mention that the system was working on 1 September, and the error appears on 4 September 2023.
I send the request in the header with HonorNonIndexedQueriesWarningMayFailRandomly
and have the index in sharePoint on the Task_Id column and I also reindexed in sharePoint la Task_Id column
Something changed in "&filter=fields/Task_Id eq {$task->id}"
Microsoft Graph
-
msft-gu • 1,355 Reputation points
2023-09-05T13:08:04.5+00:00 Hi Andrei,
Good morning and thank you for your question.
Can I please know what API endpoint are you using with "&filter=fields/Task_Id eq {$task->id}"? And have you tested this on Graph Explorer and Postman?
-
Andrei Iuresi • 5 Reputation points
2023-09-05T13:13:22.3333333+00:00 Hello,
Microsoft\Graph\Graph#1 ( [Microsoft\Graph\Graph:_accessToken] => '...' [Microsoft\Graph\Graph:_apiVersion] => 'v1.0' [Microsoft\Graph\Graph:_baseUrl] => 'https://graph.microsoft.com/' [Microsoft\Graph\Graph:_proxyPort] => null [Microsoft\Graph\Graph:_proxyVerifySSL] => null )
-
Andrei Iuresi • 5 Reputation points
2023-09-05T13:16:48.3366667+00:00 Removing the filter brings up the first row in the table from SharePoint. Something changed after September 1, but I don't know what. The system worked without any error for more than 7 months
-
Andrei Iuresi • 5 Reputation points
2023-09-05T13:20:23.4733333+00:00 Microsoft\Graph\Http\GraphRequest#1 ( [*:accessToken] => '' [*:apiVersion] => 'v1.0' [*:baseUrl] => 'https://graph.microsoft.com/' [*:endpoint] => '/sites/mysite.sharepoint.com:/sites/SITE:/lists/60b651b5-df19-44e0-a489-90c11718508c/items?expand=fields(select=ID,Invoice_Id,Vendor_Name,Vendor_CUI,Vendor_Reg_Number,Vendor_Adress,Vendor_IBAN,Customer_Name,Customer_CUI,Customer_Reg_Number,Customer_Adress,Customer_IBAN,Number_Invoice,Date_Invoice,Project_Id,Value_Invoice,TVA_Value_Invoice,Total_Value_Invoice,Added,Added_By,Updated,Updated_By,Task_Id)&filter=fields/Task_Id eq 10405' [*:headers] => [ 'Host' => 'https://graph.microsoft.com/' 'Content-Type' => 'application/json' 'SdkVersion' => 'Graph-php-1.73.0' 'Authorization' => '' 'Accept' => 'application/json;odata.metadata=none' 'Prefer' => 'HonorNonIndexedQueriesWarningMayFailRandomly' ] [*:requestBody] => null [*:requestType] => 'GET' [*:returnsStream] => false [*:returnType] => 'Microsoft\\Graph\\Model\\DriveItem' [*:timeout] => 100 [*:proxyPort] => null [*:proxyVerifySSL] => null [*:http_errors] => true )
-
msft-gu • 1,355 Reputation points
2023-09-05T13:23:08.0866667+00:00 Can you provide the endpoint, for example https://learn.microsoft.com/en-us/graph/api/list-get?view=graph-rest-1.0&tabs=http? I may be limited on Graph SDK but I can verify if this is working with Graph Explorer.
-
Andrei Iuresi • 5 Reputation points
2023-09-05T13:27:05.1733333+00:00 2023-09-05 13-26-42.545100 - Invoice: 13299 - Task: 10467 - Processing 1 of 41 ...
Exception 'GuzzleHttp\Exception\ClientException' with message 'Client error:
GET https://graph.microsoft.com/v1.0/sites/mysite.sharepoint.com:/sites/SITE:/lists/60b651b5-df19-44e0-a489-90c11718508c/items?expand=fields(select=ID,Invoice_Id,Vendor_Name,Vendor_CUI,Vendor_Reg_Number,Vendor_Adress,Vendor_IBAN,Customer_Name,Customer_CUI,Customer_Reg_Number,Customer_Adress,Customer_IBAN,Number_Invoice,Date_Invoice,Project_Id,Value_Invoice,TVA_Value_Invoice,Total_Value_Invoice,Added,Added_By,Updated,Updated_By,Task_Id)&filter=fields/Task_Id%20eq%2010467
resulted in a400 Bad Request
response:{"error":{"code":"invalidRequest","message":"Field 'Task_Id' cannot be referenced in filter or orderby as it is not indexed. Provide the 'Prefer: HonorNonIndexedQueriesWarningMayFailRandomly' header to allow this, but be warned that such queries may fail on large lists.","innerError":{"date":"2023-09-05T13:26:43","request-id":"cf7deeae-e9ed-414d-a8ed-183c51dce898","client-request-id":"cf7deeae-e9ed-414d-a8ed-183c51dce898"}}}
-
Andrei Iuresi • 5 Reputation points
2023-09-05T13:29:15.0966667+00:00 If instead of
"&filter=fields/Task_Id eq {$task->id}"
I put"&Task_Id={$task->id}"
(which is not correct) I don't get the error, but it brings from SharePoint into my application the first row it finds in the table.[*:endpoint] => '/sites/mysite.sharepoint.com:/sites/SITE:/lists/60b651b5-df19-44e0-a489-90c11718508c/items?expand=fields(select=ID,Invoice_Id,Vendor_Name,Vendor_CUI,Vendor_Reg_Number,Vendor_Adress,Vendor_IBAN,Customer_Name,Customer_CUI,Customer_Reg_Number,Customer_Adress,Customer_IBAN,Number_Invoice,Date_Invoice,Project_Id,Value_Invoice,TVA_Value_Invoice,Total_Value_Invoice,Added,Added_By,Updated,Updated_By,Task_Id)&filter=fields/Task_Id eq 10405' ```
-
Andrei Iuresi • 5 Reputation points
2023-09-05T13:48:57.2033333+00:00 prt scr from SharePoint with indexColumn
-
msft-gu • 1,355 Reputation points
2023-09-05T14:11:57.9133333+00:00 I haven't received any error when I reproduced it on my end. I would highly suggest to creating a ticket if this is happening on Graph Explorer or Postman specifically on the affected tenant and specially if the Task_ID that is being mentioned on the error has been indexed.
-
Andrei Iuresi • 5 Reputation points
2023-09-06T04:56:06.9033333+00:00 Hello,
Apparently this is a general issue as of September 4 for everyone using order by or filter in SharePoint using the API.
===
"
I have the same problem, the app has stop working this weekend. I have tried in MS Graph with different lists and documents libraries and have the same error. And the fields are indexed a long time ago.
[4:56 PM] Andrei Iuresi
Hi @Rizwan Ansari , no good news. I hope they will fix it soon. I received this answer as follows :
Title: Users may be unable to filter list items using Microsoft Graph API in SharePoint Online User impact: Users may be unable to filter list items using Microsoft Graph API in SharePoint Online.
Current status: We've identified that a recent standard service update, inadvertently contains a code regression which is causing users attempting to filter list items using Microsoft Graph API in SharePoint Online to encounter failures. We've developed a fix to repair the code regression and we're conducting extensive validation checks to ensure its efficacy. Once the fix is validated, we'll begin deploying it to the affected infrastructure to remediate impact. Scope of impact: Impact is specific to some users attempting to list items using Microsoft Graph API in SharePoint Online.
Root cause: A recent standard service update, inadvertently contains a code regression which is causing usersProfile
"
-
Andrei Iuresi • 5 Reputation points
2023-09-06T04:58:03.3466667+00:00 Hello,
Apparently this is a general issue as of September 4 for everyone using order by or filter in SharePoint using the API.
===
===
I have the same problem, the app has stop working this weekend. I have tried in MS Graph with different lists and documents libraries and have the same error. And the fields are indexed a long time ago.
[4:56 PM] Andrei Iuresi
Hi @Rizwan Ansari , no good news. I hope they will fix it soon. I received this answer as follows :
Title: Users may be unable to filter list items using Microsoft Graph API in SharePoint Online User impact: Users may be unable to filter list items using Microsoft Graph API in SharePoint Online.
Current status: We've identified that a recent standard service update, inadvertently contains a code regression which is causing users attempting to filter list items using Microsoft Graph API in SharePoint Online to encounter failures. We've developed a fix to repair the code regression and we're conducting extensive validation checks to ensure its efficacy. Once the fix is validated, we'll begin deploying it to the affected infrastructure to remediate impact. Scope of impact: Impact is specific to some users attempting to list items using Microsoft Graph API in SharePoint Online.
Root cause: A recent standard service update, inadvertently contains a code regression which is causing usersProfile
-
Andrei Iuresi • 5 Reputation points
2023-09-06T05:39:33.4466667+00:00 The system became functional again yesterday at 23:45
Sign in to comment