RuiRomano / pbimonitor

MIT License
207 stars 76 forks source link

CatalogTImer Function Issue #45

Open Bchary8 opened 5 months ago

Bchary8 commented 5 months ago

Hi,

We are facing issue while using the CatalogTimer function, which was working previously, but after changing the secret key we are getting errors. Please find the below error captured from Minitor log.

EXCEPTION: One or more errors occurred. (Error reading JObject from JsonReader. Current JsonReader item is not an object: String. Path '', line 1, position 131.) Exception : Type : System.AggregateException InnerExceptions : Type : Newtonsoft.Json.JsonReaderException LineNumber : 1 LinePosition : 131 TargetSite : Name : Load DeclaringType : Newtonsoft.Json.Linq.JObject MemberType : Method Module : Newtonsoft.Json.dll Message : Error reading JObject from JsonReader. Current JsonReader item is not an object: String. Path '', line 1, position 131. Source : Newtonsoft.Json HResult : -2146233088 StackTrace : at Newtonsoft.Json.Linq.JObject.Load(JsonReader reader, JsonLoadSettings settings) at Newtonsoft.Json.Linq.JObject.Parse(String json, JsonLoadSettings settings) at Newtonsoft.Json.Linq.JObject.Parse(String json) at Microsoft.PowerBI.Commands.Profile.InvokePowerBIRestMethod.InvokeRestMethod(String url, String body, PowerBIWebRequestMethod requestType) Message : One or more errors occurred. (Error reading JObject from JsonReader. Current JsonReader item is not an object: String. Path '', line 1, position 131.) TargetSite : Name : ThrowIfExceptional DeclaringType : System.Threading.Tasks.Task MemberType : Method Module : System.Private.CoreLib.dll InnerException : Type : Newtonsoft.Json.JsonReaderException LineNumber : 1 LinePosition : 131 TargetSite : Name : Load DeclaringType : Newtonsoft.Json.Linq.JObject MemberType : Method Module : Newtonsoft.Json.dll Message : Error reading JObject from JsonReader. Current JsonReader item is not an object: String. Path '', line 1, position 131. Source : Newtonsoft.Json HResult : -2146233088 StackTrace : at Newtonsoft.Json.Linq.JObject.Load(JsonReader reader, JsonLoadSettings settings) at Newtonsoft.Json.Linq.JObject.Parse(String json, JsonLoadSettings settings) at Newtonsoft.Json.Linq.JObject.Parse(String json) at Microsoft.PowerBI.Commands.Profile.InvokePowerBIRestMethod.InvokeRestMethod(String url, String body, PowerBIWebRequestMethod requestType) Source : System.Private.CoreLib HResult : -2146233088 StackTrace : at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification) at Microsoft.PowerBI.Commands.Profile.InvokePowerBIRestMethod.ExecuteCmdlet() at Microsoft.PowerBI.Commands.Common.PowerBICmdlet.ProcessRecord() TargetObject : Microsoft.PowerBI.Commands.Profile.InvokePowerBIRestMethod CategoryInfo : WriteError: (Microsoft.PowerBI.C…kePowerBIRestMethod:InvokePowerBIRestMethod) [Invoke-PowerBIRestMethod], AggregateException FullyQualifiedErrorId : One or more errors occurred. (Error reading JObject from JsonReader. Current JsonReader item is not an object: String. Path '', line 1, position 131.),Microsoft.PowerBI.Commands.Profile.InvokePowerBIRestMethod InvocationInfo : MyCommand : Invoke-PowerBIRestMethod ScriptLineNumber : 213 OffsetInLine : 40 HistoryId : 1 ScriptName : C:\home\site\wwwroot\Scripts\Fetch - Catalog.ps1 Line : $getInfoResult = @(Invoke-PowerBIRestMethod -Url "admin/workspaces/getInfo?$getInfoDetails" -Body $bodyStr -method Post | ConvertFrom-Json) PositionMessage : At C:\home\site\wwwroot\Scripts\Fetch - Catalog.ps1:213 char:40 + … oResult = @(Invoke-PowerBIRestMethod -Url "admin/workspaces/getInfo?$ … + ~~~~~~~~~~~~~ PSScriptRoot : C:\home\site\wwwroot\Scripts PSCommandPath : C:\home\site\wwwroot\Scripts\Fetch - Catalog.ps1 InvocationName : Invoke-PowerBIRestMethod CommandOrigin : Internal ScriptStackTrace : at , C:\home\site\wwwroot\Scripts\Fetch - Catalog.ps1: line 213 at Wait-On429Error, C:\home\site\wwwroot\Scripts\Fetch - Utils.psm1: line 184 at , C:\home\site\wwwroot\Scripts\Fetch - Catalog.ps1: line 207 at Get-ArrayInBatches, C:\home\site\wwwroot\Scripts\Fetch - Utils.psm1: line 159 at , C:\home\site\wwwroot\Scripts\Fetch - Catalog.ps1: line 204 at Get-ArrayInBatches, C:\home\site\wwwroot\Scripts\Fetch - Utils.psm1: line 159 at , C:\home\site\wwwroot\Scripts\Fetch - Catalog.ps1: line 198 at , C:\home\site\wwwroot\CatalogTimer\run.ps1: line 31 PipelineIterationInfo :

Bchary8 commented 5 months ago

Could you pls help us here to resolve the issue on priority.

WillCisler commented 5 months ago

This error is very likely to be caused by throttling - there is a line in Fetch utils that can be modified to allow for this error to prompt Wait-on-429 to pause and resume. The below can be used to remediate and I will push to a solution to main in the next week.

if ($errorText -like "*Error reading JObject from JsonReader*" -or ($errorText -like "*429 (Too Many Requests)*" -or $errorText -like "*Response status code does not indicate success: *" -or $errorText -like "*You have exceeded the amount of requests allowed*"))

here I remove "HttpRequestException" because it could also be "HttpResposeException"

Target line: https://github.com/RuiRomano/pbimonitor/blob/0f5cf43a1bfb2648a95776172a3fd369e0ef17fa/Fetch%20-%20Utils.psm1#L193

Bchary8 commented 5 months ago

Thanks for your response, could you pls let me know the status whether you have implemented the changes or still we need to wait for few more days. Need your help to priorities on this issue. Since we need to like review data in the report.

WillCisler commented 4 months ago

These changes have been made

https://github.com/RuiRomano/pbimonitor/pull/46

Bchary8 commented 4 months ago

Hi Will, we are still facing the same issue the script is failing continuously (not getting executed correctly). Could you pls let me know do we need to do any changes from our end the changes which you have implemented in the Fun or not required. If needed could you pls set up a call on this same. Below is the error we are getting now. esult: Failure Exception: The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: One or more errors occurred. (Error reading JObject from JsonReader. Current JsonReader item is not an object: String. Path '', line 1, position 131.) Stack: at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input) at System.Management.Automation.PowerShell.Worker.ConstructPipelineAndDoWork(Runspace rs, Boolean performSyncInvoke) at System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync) at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection1 input, PSDataCollection1 output, PSInvocationSettings settings) at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection1 input, PSDataCollection1 output, PSInvocationSettings settings) at System.Management.Automation.PowerShell.CoreInvoke[TOutput](IEnumerable input, PSDataCollection1 output, PSInvocationSettings settings) at System.Management.Automation.PowerShell.Invoke[T](IEnumerable input, IList1 output, PSInvocationSettings settings) at System.Management.Automation.PowerShell.Invoke[T]() at Microsoft.Azure.Functions.PowerShellWorker.PowerShell.PowerShellExtensions.InvokeAndClearCommands[T](PowerShell pwsh) in /mnt/vss/_work/1/s/src/PowerShell/PowerShellExtensions.cs:line 45 at Microsoft.Azure.Functions.PowerShellWorker.PowerShell.PowerShellManager.ExecuteUserCode(Boolean addPipelineOutput, IDictionary outputBindings) in /mnt/vss/_work/1/s/src/PowerShell/PowerShellManager.cs:line 314 at Microsoft.Azure.Functions.PowerShellWorker.PowerShell.PowerShellManager.InvokeFunction(AzFunctionInfo functionInfo, Hashtable triggerMetadata, TraceContext traceContext, RetryContext retryContext, IList`1 inputData, FunctionInvocationPerformanceStopwatch stopwatch) in /mnt/vss/_work/1/s/src/PowerShell/PowerShellManager.cs:line 262 at Microsoft.Azure.Functions.PowerShellWorker.RequestProcessor.InvokeFunction(AzFunctionInfo functionInfo, PowerShellManager psManager, FunctionInvocationPerformanceStopwatch stopwatch, InvocationRequest invocationRequest) in /mnt/vss/_work/1/s/src/RequestProcessor.cs:line 352 at Microsoft.Azure.Functions.PowerShellWorker.RequestProcessor.ProcessInvocationRequestImpl(StreamingMessage request, AzFunctionInfo functionInfo, PowerShellManager psManager, FunctionInvocationPerformanceStopwatch stopwatch) in /mnt/vss/_work/1/s/src/RequestProcessor.cs:line 319

WillCisler commented 4 months ago

Have you pulled the latest code from the Repo?

Bchary8 commented 4 months ago

Hi Will

I have seen that the changes are happen in the main git hub, but I am getting the same error. Do I need to implement the changes in any of the Catalog function. Here, I have no clue were shall I do. Could you pls guide me?. If needed we can have call for the same from my client I'd @.*** or else you can pls call to my mobile number.+91 8106999763

Pls help me here its priority to fix the issue since I am unable to get backend details.

Regards Chary

On Thu, 7 Mar 2024, 03:06 WillCisler, @.***> wrote:

Have you pulled the latest code from the Repo?

— Reply to this email directly, view it on GitHub https://github.com/RuiRomano/pbimonitor/issues/45#issuecomment-1981830406, or unsubscribe https://github.com/notifications/unsubscribe-auth/BFQ4LJD2N4G25JOEBNLNGNTYW6D6TAVCNFSM6AAAAABCFSVKM6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOBRHAZTANBQGY . You are receiving this because you authored the thread.Message ID: @.***>

Bchary8 commented 3 months ago

Hi Team Could you pls suggest me, do to this my script is failing continuously. Pls suggest me whether I need to do any changes from my end as well. So, that I can accordingly.

Regards Chary

JamesDBartlett3 commented 3 months ago

@Bchary8, are you still experiencing this issue, and if so, have you tried upgrading to the latest version of pbimonitor, as @WillCisler suggested above?