A couple of days ago a script using the "Clear-RabbitMQQueue" stopped working because now the function throws an exception. From the verbose output it seems that the default virtual host "/" shouldn't be un-escaped in the invoked URL (%2f) but for some unknown reasons now it is un-escaped to "/", and the result is an "Object not found" error.
The output of a PS shell below shows, how the queue "Monitor 1-C347847 Technical" exists in the virtual host "/", but clearing it throws the exception "Object not found".
PS C:\Scripts> Get-RabbitMQQueue @rabbitmq -Name "Monitor $name Technical"
VERBOSE: Invoking REST API: http://localhost:15672/api/queues
VERBOSE: GET http://localhost:15672/api/queues with 0-byte payload
VERBOSE: received 36349-byte response of content type application/json
Name VHost Params Messages Unacked Memory
---- ----- ------ ----------- ----------- ------------------
Monitor 1-C347847 Technical / D 0 0 17,368 B
PS C:\Scripts> Clear-RabbitMQQueue @rabbitmq -Name "Monitor $name Technical" -Confirm:$false
VERBOSE: Invoking REST API: http://localhost:15672/api/queues/%2f/Monitor+1-C347847+Technical/contents
VERBOSE: Switching off UnEscapesDotsAndSlashes flag on UriParser.
VERBOSE: DELETE http://localhost:15672/api/queues///Monitor+1-C347847+Technical/contents with 0-byte payload
VERBOSE: Restoring UriParser flags - switching on UnEscapesDotsAndSlashes flag.
Invoke-RestMethod : {"error":"Object Not Found","reason":"Not Found"}
At C:\Program Files\WindowsPowerShell\Modules\RabbitMQTools\1.2\Public\Clear-RabbitMQQueue.ps1:64 char:13
+ $result = Invoke-RestMethod $url -Credential $Credentials ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebExc
eption
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
Invoke-RestMethod : {"error":"Object Not Found","reason":"Not Found"}
At C:\Program Files\WindowsPowerShell\Modules\RabbitMQTools\1.2\Public\Clear-RabbitMQQueue.ps1:64 char:13
+ $result = Invoke-RestMethod $url -Credential $Credentials ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebExc
eption
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
PS C:\Scripts>
A couple of days ago a script using the "Clear-RabbitMQQueue" stopped working because now the function throws an exception. From the verbose output it seems that the default virtual host "/" shouldn't be un-escaped in the invoked URL (%2f) but for some unknown reasons now it is un-escaped to "/", and the result is an "Object not found" error. The output of a PS shell below shows, how the queue "Monitor 1-C347847 Technical" exists in the virtual host "/", but clearing it throws the exception "Object not found".