mikebowler / jirametrics

A tool to extract data from Jira and either generate reports or export to CSV files
Apache License 2.0
34 stars 1 forks source link

Crash while downloading board configuration from Jira Cloud #26

Closed SimoneCusimano closed 4 months ago

SimoneCusimano commented 4 months ago

I'm using v2.1.1 with Jira Cloud and unexpectedly the tool crashes. the _jiraconfig.json file looks like this { "url": "OMITTED", "personal_access_token": "OMITTED" }

Logs follow: Downloading all statuses Downloading board configuration for board XXX NoMethodError: undefined method[]' for nil:NilClass ←[0;31m download_board_configuration at [...]/jruby-9.4.6.0/lib/ruby/gems/shared/gems/jirametrics-2.1.1/lib/jirametrics/downloader.rb:173←[0m run at [...]/jruby-9.4.6.0/lib/ruby/gems/shared/gems/jirametrics-2.1.1/lib/jirametrics/downloader.rb:44←[0m ←[0;36m each at org/jruby/RubyArray.java:1983←[0m run at [...]/jruby-9.4.6.0/lib/ruby/gems/shared/gems/jirametrics-2.1.1/lib/jirametrics/downloader.rb:43←[0m download at [...]/jruby-9.4.6.0/lib/ruby/gems/shared/gems/jirametrics-2.1.1/lib/jirametrics/exporter.rb:66←[0m each_project_config at[...]/jruby-9.4.6.0/lib/ruby/gems/shared/gems/jirametrics-2.1.1/lib/jirametrics/exporter.rb:73←[0m ←[0;36m each at org/jruby/RubyArray.java:1983←[0m each_project_config at[...]/jruby-9.4.6.0/lib/ruby/gems/shared/gems/jirametrics-2.1.1/lib/jirametrics/exporter.rb:72←[0m download at [...]/jruby-9.4.6.0/lib/ruby/gems/shared/gems/jirametrics-2.1.1/lib/jirametrics/exporter.rb:51←[0m go at [...]/jruby-9.4.6.0/lib/ruby/gems/shared/gems/jirametrics-2.1.1/lib/jirametrics.rb:27←[0m run at [...]/jruby-9.4.6.0/lib/ruby/gems/shared/gems/thor-1.2.2/lib/thor/command.rb:27←[0m invoke_command at [...]/jruby-9.4.6.0/lib/ruby/gems/shared/gems/thor-1.2.2/lib/thor/invocation.rb:127←[0m dispatch at [...]/jruby-9.4.6.0/lib/ruby/gems/shared/gems/thor-1.2.2/lib/thor.rb:392←[0m start at [...]/jruby-9.4.6.0/lib/ruby/gems/shared/gems/thor-1.2.2/lib/thor/base.rb:485←[0m

at [...]/jruby-9.4.6.0/lib/ruby/gems/shared/gems/jirametrics-2.1.1/bin/jirametrics:5←[0m ←[0;36m load at org/jruby/RubyKernel.java:1211←[0m
at [...]/jruby-9.4.6.0/bin/jirametrics:25←[0m`
mikebowler commented 4 months ago

That's really weird. It's as if no filter was specified in the board.

A typical board configuration starts like this. The exception would imply that it failed to find the filter section, and I didn't think that was possible. Is there anything in your jira instance that would imply it wasn't using a board filter? If so, how would it be determining what items go on the board?

{
  "id": 1,
  "name": "SP board",
  "type": "kanban",
  "self": "https://improvingflow.atlassian.net/rest/agile/1.0/board/1/configuration",
  "location": {
    "type": "project",
    "key": "SP",
    "id": "10000",
    "self": "https://improvingflow.atlassian.net/rest/api/2/project/10000",
    "name": "Sample Project"
  },
  "filter": {
    "id": "10000",
    "self": "https://improvingflow.atlassian.net/rest/api/2/filter/10000"
  },
  "subQuery": {
    "query": "fixVersion in unreleasedVersions() OR fixVersion is EMPTY"
  },
SimoneCusimano commented 4 months ago

I investigated further and saw that the content of the _XXXstatuses.json file is { "error": "Failed to parse Connect Session Auth Token" }

Is the format of the _jiraconfig.json file right?

mikebowler commented 4 months ago

I missed that the first time. You said you were in cloud, so you need to specify an API token, not a personal access token.

It should look something like this

{
  "url": "<YOUR_URL>",
  "email": "<YOUR_EMAIL>",
  "api_token": "<YOUR_API_TOKEN>"
}

Personal access tokens are for Jira Server and Jira Data Centre

mikebowler commented 4 months ago

See https://github.com/mikebowler/jirametrics/wiki/Connecting-to-a-Jira-Instance#1-authentication-with-the-api-token-cloud

SimoneCusimano commented 4 months ago

Nice! Thank you Mike

mikebowler commented 4 months ago

The error message was certainly misleading though. I'm looking at improving that now.