ankitpokhrel / jira-cli

🔥 Feature-rich interactive Jira command line.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`404 Not Found` on selecting the default board

rexagod opened this issue · comments

Describe the bug

Hello! 👋🏼 I'm trying to set this up for an internal board that's under a project, but this fails with a 404.

┌[rexagod@nebuchadnezzar] [/dev/pts/0] [1]
└[~]> jira init
? Installation type: Cloud
? Link to Jira server: https://issues.redhat.com
? Login email: <email>
? Default project: <project>
? Default board: <board>

✗ Received unexpected response '404 Not Found' from jira. Please try again.

Please provide following details

  1. JiraCLI Version:
    (Version="main", GitCommit="eb842e18014303a575fde8e19508b3c7c13982c5", CommitDate="2023-05-09T07:09:45+00:00", GoVersion="go1.20.4", Compiler="gc", Platform="linux/amd64")
    
  2. Are you using Jira cloud or on-premise jira server?
    ✗ Missing configuration file.
    Run 'jira init' to configure the tool.
    
  3. What operating system are you using? Also mention version.
    NAME="Fedora Linux"
    VERSION="38 (Workstation Edition)"
    ID=fedora
    VERSION_ID=38
    
  4. What terminal are you using? Also mention version.
    kitty 0.28.1
    

To Reproduce

Steps to reproduce the behavior:

  1. I encountered some errors initially, so I followed #477 (comment) to fix them.
  2. On selecting a board, it still seems to fail (with a different error, 404).

Expected behavior
It successfully fetches the board details and creates the config.

commented

Hi @rexagod,

To make sure I understand the problem correctly, are you are getting 404 after selecting the board that is listed in Default board dropdown?

Few asks to help with the debugging:

  • Could you please check which API fails using the --debug flag?
  • There is a --board flag available in the init cmd that can be used to skip board selection step. That should help you with config generation. Does this temporarily solve your problem?

@ankitpokhrel Thank you for looking into this! Please find the answers to your questions below, and feel free to let me know if I can help with anything else from my side! :)

To make sure I understand the problem correctly, are you are getting 404 after selecting the board that is listed in Default board dropdown?

Correct.

Could you please check which API fails using the --debug flag?

┌[rexagod@nebuchadnezzar] [/dev/pts/0] 
└[~]> jira init --debug
? Installation type: Cloud
? Link to Jira server: https://issues.redhat.com
? Login email: <email>
⠹ Verifying login details...

REQUEST DETAILS
------------------------------------------------------------

GET /rest/api/2/myself HTTP/1.1
Host: issues.redhat.com
Authorization: Bearer [redacted]

⠇ Fetching projects...

REQUEST DETAILS
------------------------------------------------------------

GET /rest/api/2/project?expand=lead HTTP/1.1
Host: issues.redhat.com
Authorization: Bearer [redacted]

? Default project: <project>
⠇ Fetching boards for project <project>...

REQUEST DETAILS
------------------------------------------------------------

GET /rest/agile/1.0/board?projectKeyOrId=<project> HTTP/1.1
Host: issues.redhat.com
Authorization: Bearer [redacted]

? Default board: <board>
⠸ Configuring metadata. Please wait...

REQUEST DETAILS
------------------------------------------------------------

GET /rest/api/2/issue/createmeta?projectKeys=<project>&expand=projects.issuetypes.fields HTTP/1.1
Host: issues.redhat.com
Authorization: Bearer [redacted]


✗ Received unexpected response '404 Not Found' from jira. Please try again.

There is a --board flag available in the init cmd that can be used to skip board selection step. That should help you with config generation. Does this temporarily solve your problem?

Doesn't seem like it. :/

┌[rexagod@nebuchadnezzar] [/dev/pts/0] [1]
└[~]> jira init --board "<board>" --debug
? Installation type: Cloud
? Link to Jira server: https://issues.redhat.com
? Login email: <email>
⠏ Verifying login details...

REQUEST DETAILS
------------------------------------------------------------

GET /rest/api/2/myself HTTP/1.1
Host: issues.redhat.com
Authorization: Bearer [redacted]

⠦ Fetching projects...

REQUEST DETAILS
------------------------------------------------------------

GET /rest/api/2/project?expand=lead HTTP/1.1
Host: issues.redhat.com
Authorization: Bearer [redacted]

? Default project: <project>
⠏ Fetching boards for project '<project>'...

REQUEST DETAILS
------------------------------------------------------------

GET /rest/agile/1.0/board?projectKeyOrId=<project> HTTP/1.1
Host: issues.redhat.com
Authorization: Bearer [redacted]

⠼ Configuring metadata. Please wait...

REQUEST DETAILS
------------------------------------------------------------

GET /rest/api/2/issue/createmeta?projectKeys=<project>&expand=projects.issuetypes.fields HTTP/1.1
Host: issues.redhat.com
Authorization: Bearer [redacted]

✗ Received unexpected response '404 Not Found' from jira. Please try again.
commented

Thank you for additional details @rexagod & @muehan. The createmeta endpoint seem to be the problem. This was fixed in #447 but looks like some recent commit broke it. Could you check if you have same issue with v1.2.0?

commented

same problem.

GET /rest/api/2/issue/createmeta?projectKeys=WEB&expand=projects.issuetypes.fields HTTP/1.1

RESPONSE DETAILS
------------------------------------------------------------

HTTP/1.1 404

jira version
(Version="1.2.0", GitCommit="9d8a0afd75b68aa519367f93c240429117cc4090", CommitDate="2022-12-16T10:53:08+00:00", GoVersion="go1.18.3", Compiler="gc", Platform="windows/amd64")

commented

Hi @muehan, thank you for checking. Could you please provide the output of jira serverinfo command, I will try to reproduce the issue.

commented

Because of the error I can't run jira init

So the output is not helpful at all.

$ jira serverinfo
✗ Missing configuration file.
Run 'jira init' to configure the tool.
commented

Just wanted to note that I am experiencing the same issues described above on a new machine on both 1.2 and 1.4.

commented

Hi @muehan @joshangehr, since serverinfo command won't work without the config. Could you please use the following curl command to get the server info. I will try to replicate the issue.

$ curl -vvv --request GET \
  --url 'https://<server>/rest/api/2/serverInfo' \
  --user "<user>:<password>"

# If you are using bearer token
$ curl -vvv --request GET \
  -H "Authorization: Bearer <JIRA_API_TOKEN>" \
  --url 'https://<server>/rest/api/2/serverInfo'

Hello, I am experiencing the exact same issue.

Here is my serverinfo output.

EDIT: here is my version info:

(Version="1.4.0", GitCommit="eb842e18014303a575fde8e19508b3c7c13982c5", CommitDate="2023-05-09T07:09:45+00:00", GoVersion="go1.19.4", Compiler="gc", Platform="linux/amd64")

I'm on Ubuntu 22.04 and with Alacritty terminal emulator.

commented

@rexagod I just noticed that you've selected Installation type as Cloud, https://issues.redhat.com is a Local installation so please select Local as an installation type during jira init. That should solve your issue.

@jonathf Interestingly I couldn't reproduce the issue in the same Jira version as yours v9.4.7. Could you check the output of jira init --debug, is it also failing on createmeta endpoint?

commented

@ankitpokhrel With your above feedback, I was able to resolve my issue. I had selected Local as I misinterpreted the meaning in the docs. After selecting Cloud, everything is working wonderfully.

$ jira init --debug
? Installation type: Cloud
? Link to Jira server: https://jira.ruter.no
? Login email: [***]@ruter.no
⠹ Verifying login details...

REQUEST DETAILS
------------------------------------------------------------

GET /rest/api/2/myself HTTP/1.1
Host: jira.ruter.no
Authorization: Bearer [***]

⠹ Fetching projects...

REQUEST DETAILS
------------------------------------------------------------

GET /rest/api/2/project?expand=lead HTTP/1.1
Host: jira.ruter.no
Authorization: Bearer [***]

? Default project: TDS
⠹ Fetching boards for project 'TDS'...

REQUEST DETAILS
------------------------------------------------------------

GET /rest/agile/1.0/board?projectKeyOrId=TDS HTTP/1.1
Host: jira.ruter.no
Authorization: Bearer [***]

? Default board: ML Team
⠹ Configuring metadata. Please wait...

REQUEST DETAILS
------------------------------------------------------------

GET /rest/api/2/issue/createmeta?projectKeys=TDS&expand=projects.issuetypes.fields HTTP/1.1
Host: jira.ruter.no
Authorization: Bearer [***]


✗ Received unexpected response '404 ' from jira. Please try again.

Seems to me the common denomenator between the OP and me is the fact that SSO is enabled, and to log on we have to use both JIRA_AUTH_TYPE="bearer" and JIRA_API_TOKEN.

I just noticed that you've selected Installation type as Cloud, issues.redhat.com is a Local installation so please select Local as an installation type during jira init. That should solve your issue.

@ankitpokhrel That worked, THANK YOU! ❤️

Facinating, I missed that as well. All three of us assumed that the server should be cloud. It now works here as well.

Thank you for the help everyone.

I guess we can close the issue now.

@ankitpokhrel Thanks again for the timely responses and all the work you put into this! 🚀

commented

I just wanted to point out to any future readers: for me, it was important to choose Local in jira init AND downgrade to 1.2.0. I had read this thread and tried Local on 1.4.0 before downgrading, assuming that is what solved it for everyone.

(Jira server 9.4.x).

I just wanted to point out to any future readers: for me, it was important to choose Local in jira init AND downgrade to 1.2.0. I had read this thread and tried Local on 1.4.0 before downgrading, assuming that is what solved it for everyone.

Confirmed, also had to stick to 1.2.0 here to make a Local init work. I'm not 100% sure if this is the root cause, but current main/64f1f0c1 seems to force a selection between basic/mtls even if JIRA_AUTH_TYPE=bearer is set, refusing to use bearer.