TOPdeskPS icon indicating copy to clipboard operation
TOPdeskPS copied to clipboard

Disconnect-TdService

Open mabster opened this issue 4 years ago • 3 comments

Prerequisites

Put an X between the brackets on each line to confirm you have completed them:

  • [X] The issue is still present in the latest version of the module.
  • [X] The issue has not been previously reported.

Describe the bug Disconnect-TdService throws an exception.

To Reproduce Connect to TOPdesk with a valid operator and application password. Call Disconnect-TdService.

Expected behavior The command executes without error.

Screenshots or Transcripts

Disconnect-TdService

Invoke-RestMethod : Object reference not set to an instance of an object. At C:\Program Files\WindowsPowerShell\Modules\TOPdeskPS\0.1.5\TOPdeskPS.psm1:2861 char:19

  •     $result = Invoke-RestMethod @parameter -ErrorAction Stop
    
  •               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [Invoke-RestMethod], NullReferenceException
    • FullyQualifiedErrorId : System.NullReferenceException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

Additional context Maybe we don't need to disconnect. Feel free to let me know and just go ahead and close this issue if that's the case. :)

mabster avatar Jul 27 '20 05:07 mabster

Thanks for creating an issue for this. I will be looking at these this week and hopefully pushing out a new update to the module shortly after that.

On Mon, Jul 27, 2020 at 1:33 AM Matt Hamilton [email protected] wrote:

Prerequisites

Put an X between the brackets on each line to confirm you have completed them:

  • The issue is still present in the latest version of the module.
  • The issue has not been previously reported.

Describe the bug Disconnect-TdService throws an exception.

To Reproduce Connect to TOPdesk with a valid operator and application password. Call Disconnect-TdService.

Expected behavior The command executes without error.

Screenshots or Transcripts

Disconnect-TdService

Invoke-RestMethod : Object reference not set to an instance of an object. At C:\Program Files\WindowsPowerShell\Modules\TOPdeskPS\0.1.5\TOPdeskPS.psm1:2861 char:19

   $result = Invoke-RestMethod @parameter -ErrorAction Stop
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  • CategoryInfo : NotSpecified: (:) [Invoke-RestMethod], NullReferenceException
    • FullyQualifiedErrorId : System.NullReferenceException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

Additional context Maybe we don't need to disconnect. Feel free to let me know and just go ahead and close this issue if that's the case. :)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/AndrewPla/TOPdeskPS/issues/102, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHW57ACJXU6AUAXJIBDZE53R5UGSVANCNFSM4PIMOJ5A .

AndrewPla avatar Jul 27 '20 08:07 AndrewPla

No, thank YOU for the module! Already doing cool things with the TOPdesk API thanks to your work!

mabster avatar Jul 27 '20 12:07 mabster

Some more info on this. Turns out the NullReferenceException only happens if you try to call Disconnect-TdService again after it has errored the first time. The initial error I'm getting is:

Invoke-RestMethod : The remote server returned an error: (401) Unauthorized. At C:\Program Files\WindowsPowerShell\Modules\TOPdeskPS\0.1.5\TOPdeskPS.psm1:2864 char:19

So it's like I don't have access to the "logout" endpoint, which is weird because I'm definitely connected to our TOPdesk instance.

mabster avatar Aug 31 '20 00:08 mabster