AtlassianPS / JiraPS

PowerShell module to interact with Atlassian JIRA
https://AtlassianPS.org/module/JiraPS
MIT License
322 stars 131 forks source link

Error when running New-JiraSession since 2.12 #374

Closed martin9700 closed 4 years ago

martin9700 commented 4 years ago

Description

Since upgrading to JiraPS 2.12.0 I have been getting an error when running New-JiraSession.

Failed to authenticate to Jira because "Exception calling "GetLeftPart" with "1" argument(s): "This operation is not supported for a relative URI.""

Tracing the program this is occurring in Invoke-JiraMethod on line 82:

[Uri]$Uri = $Uri.GetLeftPart("Path")

$URI looks like this:

$URI

AbsolutePath   : 
AbsoluteUri    : 
LocalPath      : 
Authority      : 
HostNameType   : 
IsDefaultPort  : 
IsFile         : 
IsLoopback     : 
PathAndQuery   : 
Segments       : 
IsUnc          : 
Host           : 
Port           : 
Query          : 
Fragment       : 
Scheme         : 
OriginalString : /rest/api/2/mypermissions
DnsSafeHost    : 
IdnHost        : 
IsAbsoluteUri  : False
UserEscaped    : False
UserInfo       :

Steps To Reproduce

Simply run New-JiraSession

Expected behavior

Screenshots

Your Environment

Name   Version
----   -------
JiraPS 2.12.1 
JiraPS 2.12.0 
JiraPS 2.11.1 
JiraPS 2.11.0 
JiraPS 2.10.3 

Name                      Value                  
----                      -----                  
PSVersion                 5.1.14393.2969         
PSEdition                 Desktop                
PSCompatibleVersions      {1.0, 2.0, 3.0, 4.0...}
BuildVersion              10.0.14393.2969        
CLRVersion                4.0.30319.42000        
WSManStackVersion         3.0                    
PSRemotingProtocolVersion 2.3                    
SerializationVersion      1.1.0.1

Possible Solution

May be as simple as updating New-JiraSession to use a non-relative URI?

lipkau commented 4 years ago

Hi @martin9700

You mention version 2.12.0, but your environment also lists a newer version: v2.12.1.

Can you test this with the version 2.12.1? I would expect that to be already solved with that version

martin9700 commented 4 years ago

Hi @lipkau, It did not work with 2.12.1. I mentioned 2.12.0 because that's when we first noticed the behavior. But when I did the bug report I did try it with 2.12.1.

lipkau commented 4 years ago

Have you set the server config at least once after the update?

On Wed 21. Aug 2019 at 13:12, MartinPugh notifications@github.com wrote:

Hi @lipkau https://github.com/lipkau, It did not work with 2.12.1. I mentioned 2.12.0 because that's when we first noticed the behavior. But when I did the bug report I did try it with 2.12.1.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/AtlassianPS/JiraPS/issues/374?email_source=notifications&email_token=ABGC6ZWJ7QS5VER4NT6H3QLQFUPLHA5CNFSM4IN3VVCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4ZJ63I#issuecomment-523411309, or mute the thread https://github.com/notifications/unsubscribe-auth/ABGC6ZWEAKCUMEGUQGLDAOTQFUPLHANCNFSM4IN3VVCA .

martin9700 commented 4 years ago

I have not! Worked on first server, testing our Jenkins build (give me a bit, in a long, long LONG meeting).

martin9700 commented 4 years ago

Update, the Set-JiraServerConfig and version 2.12.1 (I'm assuming it was the version upgrade too) did the trick. I've actually added the Set command to the script just to catch future changes like this. Wack-a-mole!

Thanks for the support.