Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Issue] - Health Checker - Using parameter -ScriptUpdateOnly causes an error when the script isn't able to connect to the internet. #2230

Open
dpaulson45 opened this issue Nov 25, 2024 · 0 comments · May be fixed by #2231

Comments

@dpaulson45
Copy link
Member

Describe the issue
When using -ScriptUpdateOnly on a server that doesn't have internet access, we get the following output.

Image

Expected behavior
We should provide a clearer error message and provide that the reason why we didn't update the script was because of an exception to get to the internet and that customer's shouldn't provide the information to us.

Script Output

Starting Logger Instance 11/25/2024 07:14:50
Calling Invoke-WebRequestWithProxyDetection
Calling Confirm-ProxyServer
No proxy server configuration detected
Invoke-WebRequest : The remote name could not be resolved: 'aka.ms'
Inner Exception:    at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.GetResponse(WebRequest request)
   at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.ProcessRecord()
Position Message: At C:\Users\Han\Desktop\HealthChecker.ps1:17079 char:9
+         Invoke-WebRequest @params
+         ~~~~~~~~~~~~~~~~~~~~~~~~~
Script Stack: at Invoke-WebRequestWithProxyDetection, C:\Users\Han\Desktop\HealthChecker.ps1: line 17079
at Get-ScriptUpdateAvailable, C:\Users\Han\Desktop\HealthChecker.ps1: line 17115
at Test-ScriptVersion, C:\Users\Han\Desktop\HealthChecker.ps1: line 17271
at <ScriptBlock><End>, C:\Users\Han\Desktop\HealthChecker.ps1: line 17366
at <ScriptBlock>, <No file>: line 1
Unable to check for updates: System.Management.Automation.MethodInvocationException: Exception calling "GetString" with "1" argument(s): "Array cannot be null.
Parameter name: bytes" ---> System.ArgumentNullException: Array cannot be null.
Parameter name: bytes
   at System.Text.Encoding.GetString(Byte[] bytes)
   at CallSite.Target(Closure , CallSite , Encoding , Object )
   --- End of inner exception stack trace ---
   at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
   at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
No update of the script performed.
There appears to have been some errors in the script. To assist with debugging of the script, please send the HealthChecker-Debug_*.txt, HealthChecker-Errors.json, and .xml file to [email protected].


Errors that occurred that wasn't handled
Error Index: 0
 : Exception calling "GetString" with "1" argument(s): "Array cannot be null.
Parameter name: bytes"
Inner Exception:    at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
   at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
Position Message: At C:\Users\Han\Desktop\HealthChecker.ps1:17115 char:13
+             $versionData = [Text.Encoding]::UTF8.GetString((Invoke-We ...
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Script Stack: at Get-ScriptUpdateAvailable, C:\Users\Han\Desktop\HealthChecker.ps1: line 17115
at Test-ScriptVersion, C:\Users\Han\Desktop\HealthChecker.ps1: line 17271
at <ScriptBlock><End>, C:\Users\Han\Desktop\HealthChecker.ps1: line 17366
at <ScriptBlock>, <No file>: line 1
-----------------------------------

Repro Steps

This doesn't report an issue with the normal run, because we loop through and catch all the errors the other way within Invoke-HealthCheckerMainReport

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant