pnp / powershell

PnP PowerShell
https://pnp.github.io/powershell
MIT License
673 stars 344 forks source link

Submit-PnPSearchQuery fails when using -All parameter #2345

Closed pmatthews05 closed 2 years ago

pmatthews05 commented 2 years ago

Notice

Many bugs reported are actually related to the PnP Framework which is used behind the scenes. Consider carefully where to report an issue:

Reporting an Issue or Missing Feature

I am reporting an issue when performing a Search Query using the -All parameter. Was working on Monday 12th August, but not worked since.

Expected behavior

When calling a Submit-PnPSearchQuery using either with the parameter -All or without, it should return the results. image

Actual behavior

When using -All the error message returns saying: Search has encountered a problem that prevents results from being returned. If the issue persists, please contact your administrator.

image

I am running as an App-Only with Azure Active Directory. The permission I have on the App-Only is "SharePoint - Sites.FullControl.All" I have also tested using my own account with -PnPManagmentShell which has Site Collection Administrator over the site path I'm searching.

Steps to reproduce behavior

The call I'm making is to return all STS from a given path. Basically giving me all the subsites.

Calling Get-PnPException returns the following

Message          : Search has encountered a problem that prevents results from being returned.  If the issue persists, please contact your administrator.
Stacktrace       :    at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)
                      at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()
                      at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServerAsync(ChunkStringBuilder sb)
                      at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryAsync()
                      at Microsoft.SharePoint.Client.ClientRuntimeContext.ExecuteQueryAsync()
                      at Microsoft.SharePoint.Client.ClientContext.ExecuteQueryAsync()
                      at Microsoft.SharePoint.Client.ClientContextExtensions.ExecuteQueryImplementation(ClientRuntimeContext clientContext, Int32 retryCount,
                   String userAgent)
                      at Microsoft.SharePoint.Client.ClientContextExtensions.ExecuteQueryRetry(ClientRuntimeContext clientContext, Int32 retryCount, String
                   userAgent)
                      at PnP.PowerShell.Commands.Search.SubmitSearchQuery.Run() in c:\build\src\Commands\Search\SubmitSearchQuery.cs:line 127
                      at PnP.PowerShell.Commands.Search.SubmitSearchQuery.ExecuteCmdlet() in c:\build\src\Commands\Search\SubmitSearchQuery.cs:line 190
                      at PnP.PowerShell.Commands.PnPSharePointCmdlet.ProcessRecord() in c:\build\src\Commands\Base\PnPSharePointCmdlet.cs:line 114
ScriptLineNumber : 1

What is the version of the Cmdlet module you are running?

(you can retrieve this by executing Get-Module -Name "PnP.PowerShell" -ListAvailable) Currently running 1.11.0

Which operating system/environment are you running PnP PowerShell on?

gautamdsheth commented 2 years ago

This is an issue with Search results in your specific tenant. Works fine in couple of tenants that I tested.

Would request you to raise a Microsoft ticket and/or raise an issue in SP dev docs library here:

https://github.com/SharePoint/sp-dev-docs

The problem is coming from the API level , as you yourself mentioned that it was working fine earlier but suddenly changed. We wont be able to help you here, am closing this issue.

pmatthews05 commented 2 years ago

Hi @gautamdsheth Thank you for your response. Can you advise, or point to the line in the code, that makes the call?

Is the API call not the same with or without -all? Just with All it handles the over 500 results paging and subsequent call, and returns the entire result set? The result I was calling it on only had 12 items in this case, so it shouldn't have needed to make another call.

gautamdsheth commented 2 years ago

Hi, you can find the code here:

https://github.com/pnp/powershell/blob/dev/src/Commands/Search/SubmitSearchQuery.cs

As you can check from the history, we haven't made any changes for quite a few months.

Oukilip commented 2 years ago

Hi, I'm having the exact same issue when using -All. It was working fine until this week-end.

Not sure if something changed on MS site as I have no issue when running the same query in SP Editor.

KR.

kloosterj commented 2 years ago

This same issue start in our tenant recently, later on we found SP434445 in our Service Health messages, stating: " A recent search code change introduced a problem that causes failures during ingestion of items being indexed on SharePoint Online site collections that have over 1 million items or are over 100 GB in size." Wouldn't be surprised if this is causing the issue.

hajjkh commented 4 months ago

I have the same issue. It was working before. I created a support ticket and MS support sending me to pnp community. The pnp community send me to MS support :( @gautamdsheth please help?

Which api is broken from ms? Maybe I can tell MS support to investigate that specific api.