ankitpokhrel / jira-cli

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

Got response in unexpected format when fetching metadata #388

Open maciekrb opened 2 years ago

maciekrb commented 2 years ago

Describe the bug jira init exits with the error Got response in unexpected format when fetching metadata. Please try again

Please provide following details

  1. JiraCLI Version:
    (Version="v0.3.0", GitCommit="", CommitDate="", GoVersion="go1.16.1", Compiler="gc", Platform="darwin/amd64")
  2. Are you using Jira cloud or on-premise jira server? Also mention the version for on-premise installation.
    Jira Cloud
  3. What operating system are you using? Also mention version.
    macOS Catalina 10.15.7
  4. What terminal are you using? Also mention version.
    alacritty 0.10.1 (2844606)

To Reproduce

Steps to reproduce the behavior:

  1. export the JIRA_API_TOKEN
  2. run jira init
  3. Follow the prompts After choosing the default board, the error is printed.

Expected behavior Configuration finalization

Screenshots

Additional context When running with the --debug flat, all responses are 200 OK

ankitpokhrel commented 2 years ago

Hi @maciekrb, could you please check if you get same error with the latest beta release?

pcontezini commented 2 years ago

Same error here:

(Version="1.0.0", GitCommit="e94433858ee31e16d4b41c14032864f3c5361115", CommitDate="2022-06-23T06:35:37+00:00", GoVersion="go1.18.3", Compiler="gc", Platform="darwin/amd64")

Installed from homebrew today, using a cloud jira instance, the error appears in any project or board selected.

macos monterrey 12.5 with iterm-2 3.4.16

ankitpokhrel commented 2 years ago

Hi @pcontezini, I couldn't reproduce this in my cloud instance but I suspect this might be related to the changes coming in the Jira 9.0 (#425). Perhaps not all regions for the cloud instance are updated yet so its working for me. I will try to create a fix for 9.0 and hopefully that will fix the issue.

stan-janssen commented 2 years ago

I have the same issue. This is with jira cli 1.1.0. connecting to a Jira Cloud instance. After selecting the default board, this is the interaction:


⠙ Configuring metadata. Please wait...

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

GET /rest/api/2/issue/createmeta?projectKeys=###REDACTED###&expand=projects.issuetypes.fields HTTP/1.1
Host: #MYCOMPANY#.atlassian.net
Authorization: Basic ###REDACTED###

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

HTTP/1.1 200 OK
Transfer-Encoding: chunked
Atl-Traceid: 9c73b23c7e7bb274
Cache-Control: no-cache, no-store, no-transform
Content-Type: application/json;charset=UTF-8
Date: Thu, 08 Sep 2022 13:53:55 GMT
Expect-Ct: report-uri="https://web-security-reports.services.atlassian.com/expect-ct-report/atlassian-proxy", max-age=86400
Nel: {"failure_fraction": 0.001, "include_subdomains": true, "max_age": 600, "report_to": "endpoint-1"}
Report-To: {"endpoints": [{"url": "https://dz8aopenkvv6s.cloudfront.net"}], "group": "endpoint-1", "include_subdomains": true, "max_age": 600}
Server: globaledge-envoy
Set-Cookie: atlassian.xsrf.token=###REDACTED###; path=/; SameSite=None; Secure
Strict-Transport-Security: max-age=63072000; preload
Timing-Allow-Origin: *
Vary: Accept-Encoding
X-Aaccountid: ###REDACTED###
X-Arequestid: ###REDACTED###
X-Content-Type-Options: nosniff
X-Envoy-Upstream-Service-Time: 96
X-Xss-Protection: 1; mode=block

✗ Got response in unexpected format when fetching metadata. Please try again.
joschi commented 1 year ago

Same issue here:

❯ jira version
(Version="1.1.0", GitCommit="3b93e147eac468ad985bdece27469153b4bb2814", CommitDate="2022-08-14T08:10:40+00:00", GoVersion="go1.18.3", Compiler="gc", Platform="darwin/arm64")

Error when fetching meta data:

? Default board: None
⠼ Configuring metadata. Please wait...

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

GET /rest/api/2/issue/createmeta?projectKeys=[redacted]&expand=projects.issuetypes.fields HTTP/1.1
Host: [redacted].atlassian.net
Authorization: Basic [redacted]

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

HTTP/1.1 200 OK
Transfer-Encoding: chunked
Atl-Traceid: [redacted]
Cache-Control: no-cache, no-store, no-transform
Content-Type: application/json;charset=UTF-8
Date: Fri, 18 Nov 2022 08:24:38 GMT
Expect-Ct: report-uri="https://web-security-reports.services.atlassian.com/expect-ct-report/atlassian-proxy", max-age=86400
Nel: {"failure_fraction": 0.001, "include_subdomains": true, "max_age": 600, "report_to": "endpoint-1"}
Report-To: {"endpoints": [{"url": "https://dz8aopenkvv6s.cloudfront.net"}], "group": "endpoint-1", "include_subdomains": true, "max_age": 600}
Server: AtlassianEdge
Set-Cookie: atlassian.xsrf.token=[redacted]_lin; path=/; SameSite=None; Secure
Strict-Transport-Security: max-age=63072000; preload
Timing-Allow-Origin: *
Vary: Accept-Encoding
X-Aaccountid: [redacted]
X-Arequestid: [redacted]
X-Content-Type-Options: nosniff
X-Xss-Protection: 1; mode=block

✗ Got response in unexpected format when fetching metadata. Please try again.

It looks like this happens in my case when selecting a default project which doesn't have any boards and issue fields set up.

Running the failing request, it returns an empty response:

❯ curl -i -H 'Authorization: Basic [redacted]' 'https://[redacted].atlassian.net/rest/api/
2/issue/createmeta?projectKeys=[redacted]&expand=projects.issuetypes.fields'
HTTP/2 200 
date: Fri, 18 Nov 2022 08:33:20 GMT
content-type: application/json;charset=UTF-8
server: AtlassianEdge
timing-allow-origin: *
x-arequestid: [redacted]
set-cookie: atlassian.xsrf.token=[redacted]_lin; path=/; SameSite=None; Secure
x-aaccountid: [redacted]
cache-control: no-cache, no-store, no-transform
vary: Accept-Encoding
expect-ct: report-uri="https://web-security-reports.services.atlassian.com/expect-ct-report/atlassian-proxy", max-age=86400
strict-transport-security: max-age=63072000; preload
x-content-type-options: nosniff
x-xss-protection: 1; mode=block
atl-traceid: [redacted]
report-to: {"endpoints": [{"url": "https://dz8aopenkvv6s.cloudfront.net"}], "group": "endpoint-1", "include_subdomains": true, "max_age": 600}
nel: {"failure_fraction": 0.001, "include_subdomains": true, "max_age": 600, "report_to": "endpoint-1"}

{"expand":"projects","projects":[]}
draxil commented 9 months ago

For some reason I got this, and then tried Cloud instead of local and then it was fine. I'm not really sure what I'm doing at this stage, but this was the first error I got and things had seem to be talking well (getting the list of projects okay), which is what had lead to me thinking local was correct.

Hope this helps someone even if it's a little vague!