OutOfMemoryException

I have a dashboard that is running some commands from a 3rd-party PowerShell Module (Unity-PowerShell). I can run many of these commands with no problem, but one errors out. In the dashboard log I see:

[06-08-21 01:41:25 PM] An error occurred: Exception of type 'System.OutOfMemoryException' was thrown.
Endpoint: bdd5520c-dd2d-4ae3-a206-b27a94a72894
Session: b231c37b-4e63-40b3-a507-a442d4d80909
File: 
Endpoint Start Line: 182
Endpoint End Line: 227
Stack Trace: at <ScriptBlock>, <No file>: line 34
 
[06-08-21 01:41:25 PM] An error occurred: The remote server returned an error: (422) Unprocessable Entity.
Endpoint: bdd5520c-dd2d-4ae3-a206-b27a94a72894
Session: b231c37b-4e63-40b3-a507-a442d4d80909
File: 
Endpoint Start Line: 182
Endpoint End Line: 227
Stack Trace: at Send-UnityRequest, <No file>: line 33
at Set-UnityLUN<Process>, <No file>: line 212
at <ScriptBlock>, <No file>: line 35

Any idea what might be happening? The code works when I run it in PowerShell directly on the PSU server.

Product: PowerShell Universal
Version: 1.5.18

Is it the Send-UnityRequest command causing this or another one and does the dashboard process have super high memory usage when you are using it?

Dashboard memory use starts at 153MB and pretty much stays there even after the error.

The last command my dashboard runs before the error is Set-UnityLUN. It looks like Send-UnityRequest is a helper function it calls.

Can you try to capture the .NET stack trace for this?

try {
# the command here
} catch {
$_.Exception.StackTrace | Out-File .\temp.txt
}

I’m just wondering if that will narrow down exactly what might be causing it.