I have done a script that use Get-CoinbaseProProductTicker every 15 sec.
Don't know if it matters. but the script and two other functions inside, one of those function that are nested inside the script is the Get-CoinbaseProProductTicker.
The script can sometimes run between 1-2 hours before the module crash, and it end up with errors and all the coinbase functions not working.
I tried to optimize the code in my script to limit the API calls, and also make sure no memory leaks was done.
when the issue happens, i cannot remove-module or import-module, and trying to import specific functions, result in the thread problem i never seen before in Powershell
When I try to import module
PSMessageDetails :
Exception : System.Management.Automation.RuntimeException: Unable to import Coinbase Pro products & currencies.
at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)
TargetObject : Unable to import Coinbase Pro products & currencies.
CategoryInfo : OperationStopped: (Unable to impor...s & currencies.:String) [], RuntimeException
FullyQualifiedErrorId : Unable to import Coinbase Pro products & currencies.
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at , C:\Program Files\WindowsPowerShell\Modules\CoinbasePro-Powershell\0.8.1\CoinbasePro-Powershell.psm1: line 47
at , : line 1
PipelineIterationInfo : {}
PSMessageDetails :
Exception : System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.Management.Automation.PSInvalidOperationException: There is no Runspace available to run scripts in this thread. You can provide one in the DefaultRunspace property of the System.Management.Automation.Runspaces.Runspace type. The script block you attempted to invoke was: $true
at System.Net.TlsStream.EndWrite(IAsyncResult asyncResult)
at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar)
--- End of inner exception stack trace ---
at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.GetResponse(WebRequest request)
at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.ProcessRecord()
TargetObject : System.Net.HttpWebRequest
CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at Invoke-CoinbaseProRequest, C:\Program Files\WindowsPowerShell\Modules\CoinbasePro-Powershell\0.8.1\Functions\Invoke-CoinbaseRequest.ps1: line 23
at Get-CoinbaseProCurrencies, C:\Program Files\WindowsPowerShell\Modules\CoinbasePro-Powershell\0.8.1\Functions\Public\Get-CoinbaseProCurrencies.ps1: line 16
at , C:\Program Files\WindowsPowerShell\Modules\CoinbasePro-Powershell\0.8.1\CoinbasePro-Powershell.psm1: line 44
at , : line 1
PipelineIterationInfo : {}
PSMessageDetails :
Exception : System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.Management.Automation.PSInvalidOperationException: There is no Runspace available to run scripts in this thread. You can provide one in the DefaultRunspace property of the System.Management.Automation.Runspaces.Runspace type. The script block you attempted to invoke was: $true
at System.Net.TlsStream.EndWrite(IAsyncResult asyncResult)
at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar)
--- End of inner exception stack trace ---
at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.GetResponse(WebRequest request)
at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.ProcessRecord()
TargetObject : System.Net.HttpWebRequest
CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at Invoke-CoinbaseProRequest, C:\Program Files\WindowsPowerShell\Modules\CoinbasePro-Powershell\0.8.1\Functions\Invoke-CoinbaseRequest.ps1: line 23
at Get-CoinbaseProProducts, C:\Program Files\WindowsPowerShell\Modules\CoinbasePro-Powershell\0.8.1\Functions\Public\Get-CoinbaseProProducts.ps1: line 17
at , C:\Program Files\WindowsPowerShell\Modules\CoinbasePro-Powershell\0.8.1\CoinbasePro-Powershell.psm1: line 43
at , : line 1
PipelineIterationInfo : {}
When i try one of the command
Exception : System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.Management.Automation.PSInvalidOperationException: There is no Runspace available to run scripts in this thread. You can provide one in the DefaultRunspace property of the System.Management.Automation.Runspaces.Runspace type. The script block you attempted to invoke was: $true at System.Net.TlsStream.EndWrite(IAsyncResult asyncResult) at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar) --- End of inner exception stack trace --- at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.GetResponse(WebRequest request) at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.ProcessRecord() TargetObject : System.Net.HttpWebRequest CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand ErrorDetails : InvocationInfo : System.Management.Automation.InvocationInfo ScriptStackTrace : at Invoke-CoinbaseProRequest, <No file>: line 23 at Get-CoinbaseProProductTicker, <No file>: line 16 at <ScriptBlock>, <No file>: line 1 PipelineIterationInfo : {}
I have done a script that use Get-CoinbaseProProductTicker every 15 sec.
Don't know if it matters. but the script and two other functions inside, one of those function that are nested inside the script is the Get-CoinbaseProProductTicker.
The script can sometimes run between 1-2 hours before the module crash, and it end up with errors and all the coinbase functions not working.
I tried to optimize the code in my script to limit the API calls, and also make sure no memory leaks was done.
when the issue happens, i cannot remove-module or import-module, and trying to import specific functions, result in the thread problem i never seen before in Powershell
When I try to import module
PSMessageDetails :
Exception : System.Management.Automation.RuntimeException: Unable to import Coinbase Pro products & currencies.
at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)
TargetObject : Unable to import Coinbase Pro products & currencies.
CategoryInfo : OperationStopped: (Unable to impor...s & currencies.:String) [], RuntimeException
FullyQualifiedErrorId : Unable to import Coinbase Pro products & currencies.
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at , C:\Program Files\WindowsPowerShell\Modules\CoinbasePro-Powershell\0.8.1\CoinbasePro-Powershell.psm1: line 47
at , : line 1
PipelineIterationInfo : {}
PSMessageDetails :
Exception : System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.Management.Automation.PSInvalidOperationException: There is no Runspace available to run scripts in this thread. You can provide one in the DefaultRunspace property of the System.Management.Automation.Runspaces.Runspace type. The script block you attempted to invoke was: $true
at System.Net.TlsStream.EndWrite(IAsyncResult asyncResult)
at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar)
--- End of inner exception stack trace ---
at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.GetResponse(WebRequest request)
at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.ProcessRecord()
TargetObject : System.Net.HttpWebRequest
CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at Invoke-CoinbaseProRequest, C:\Program Files\WindowsPowerShell\Modules\CoinbasePro-Powershell\0.8.1\Functions\Invoke-CoinbaseRequest.ps1: line 23
at Get-CoinbaseProCurrencies, C:\Program Files\WindowsPowerShell\Modules\CoinbasePro-Powershell\0.8.1\Functions\Public\Get-CoinbaseProCurrencies.ps1: line 16
at , C:\Program Files\WindowsPowerShell\Modules\CoinbasePro-Powershell\0.8.1\CoinbasePro-Powershell.psm1: line 44
at , : line 1
PipelineIterationInfo : {}
PSMessageDetails :
Exception : System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.Management.Automation.PSInvalidOperationException: There is no Runspace available to run scripts in this thread. You can provide one in the DefaultRunspace property of the System.Management.Automation.Runspaces.Runspace type. The script block you attempted to invoke was: $true
at System.Net.TlsStream.EndWrite(IAsyncResult asyncResult)
at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar)
--- End of inner exception stack trace ---
at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.GetResponse(WebRequest request)
at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.ProcessRecord()
TargetObject : System.Net.HttpWebRequest
CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at Invoke-CoinbaseProRequest, C:\Program Files\WindowsPowerShell\Modules\CoinbasePro-Powershell\0.8.1\Functions\Invoke-CoinbaseRequest.ps1: line 23
at Get-CoinbaseProProducts, C:\Program Files\WindowsPowerShell\Modules\CoinbasePro-Powershell\0.8.1\Functions\Public\Get-CoinbaseProProducts.ps1: line 17
at , C:\Program Files\WindowsPowerShell\Modules\CoinbasePro-Powershell\0.8.1\CoinbasePro-Powershell.psm1: line 43
at , : line 1
PipelineIterationInfo : {}
When i try one of the command
Exception : System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.Management.Automation.PSInvalidOperationException: There is no Runspace available to run scripts in this thread. You can provide one in the DefaultRunspace property of the System.Management.Automation.Runspaces.Runspace type. The script block you attempted to invoke was: $true at System.Net.TlsStream.EndWrite(IAsyncResult asyncResult) at System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar) --- End of inner exception stack trace --- at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.GetResponse(WebRequest request) at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.ProcessRecord() TargetObject : System.Net.HttpWebRequest CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand ErrorDetails : InvocationInfo : System.Management.Automation.InvocationInfo ScriptStackTrace : at Invoke-CoinbaseProRequest, <No file>: line 23 at Get-CoinbaseProProductTicker, <No file>: line 16 at <ScriptBlock>, <No file>: line 1 PipelineIterationInfo : {}