ankitpokhrel / jira-cli

🔥 Feature-rich interactive Jira command line.
MIT License
4k stars 209 forks source link

During init: Got response in unexpected format when fetching metadata. Please try again. #742

Open justinphelps opened 5 months ago

justinphelps commented 5 months ago

Describe the bug After logging in and scrolling through the boards, I choose my board and get: " Got response in unexpected format when fetching metadata. Please try again." The same happens when I choose "None" for default board.

Please provide following details

  1. JiraCLI Version:
    (Version="1.5.1", GitCommit="0e0f82d52ef5a775d2cc662fbe38d9732b9b5c59", CommitDate="2024-01-20T10:48:06+00:00", GoVersion="go1.21.5", Compiler="gc", Platform="darwin/arm64")
  2. Are you using Jira cloud or on-premise jira server?
    This isn't available since I can't get past the init stage.  We're on Cloud
  3. What operating system are you using? Also mention version.
    
    MacOS Sonoma Version 14.5 (23F79)    ```
  4. What terminal are you using? Also mention version.
    
    MacOS Terminal Version 2.14 (453)    ```

To Reproduce

Steps to reproduce the behavior:

  1. run jira init --debug --server https://nope.atlassian.net --installation cloud --login me@nope.com
  2. Select default project: EE
  3. fail

Expected behavior Take me to the board/issues.

Screenshots image Additional context

justinphelps commented 5 months ago

A little more information. This is what the API returns whether I choose a default board or None:

curl --request GET --url 'https://nope.atlassian.net/rest/api/2/issue/createmeta?projectKeys=EE&expand=projects.issuetypes.fields' --user "`me@nope.com:$JIRA_API_TOKEN" --header 'Accept: application/json'

{"expand":"projects","projects":[]}

tj-smith47 commented 5 months ago

@justinphelps Try passing the --project <project> --board <board> flags as well.

$ JIRA_API_TOKEN=$(echo -e "$JIRA_API_TOKEN") jira init \
    --installation cloud \
    --server <url> \
    --login <email> \
    --project <project> \
    --board <board> \
    --debug

I'm able to auth via an automated script successfully without and prompts for input using this method. In my case, I also had to echo the API key with escaping (-e) to get the Jira API token to be read properly because it runs in kubernetes.