Skip to content

Unauthorized (JIRA::HTTPError) during Jira connect via Access Token #404

@kszorin

Description

@kszorin

Environment

Jira standalone 8.20.10
Authorization to Jira via User Token
jira-ruby version: 2.2.0, 2.3.0
Bundler 2.4.12

Steps

  • run job on Gitlab at the and of April 2023
  • jira-ruby try to connect to Jira
options = {
    :site => ENV['JIRA_URL'],
    :context_path => '',
    :auth_type => :jwt,
    :default_headers => { 'Authorization' =>  "Bearer #{ENV['JIRA_ACCESS_TOKEN']}" }
  }
  client =  JIRA::Client.new(options)

   ...
  jql = "PROJECT = '#{project_name}' AND fixVersion = '#{jira_version}'"
  issues = client.Issue.jql(jql)   # <----------------------------------------------------- EXCEPTION!

Expect

Successful connection and JQL Response

Actual

bundler: failed to load command: fastlane (/builds/...-App/...-app-android/vendor/ruby/3.0.0/bin/fastlane)
/builds/...-App/...-app-android/vendor/ruby/3.0.0/gems/jira-ruby-2.3.0/lib/jira/request_client.rb:13:in `request': Unauthorized (JIRA::HTTPError)
	from /builds/...-App/...-app-android/vendor/ruby/3.0.0/gems/jira-ruby-2.3.0/lib/jira/client.rb:306:in `request'
	from /builds/...-App/...-app-android/vendor/ruby/3.0.0/gems/jira-ruby-2.3.0/lib/jira/client.rb:279:in `get'
	from /builds/...-App/...-app-android/vendor/ruby/3.0.0/gems/jira-ruby-2.3.0/lib/jira/resource/issue.rb:80:in `jql'
	from /builds/...-App/...-app-android/vendor/ruby/3.0.0/gems/jira-ruby-2.3.0/lib/jira/base_factory.rb:31:in `block (2 levels) in delegate_to_target_class'

What have I already checked

Token is valid (checked by curl)
JQL is valid (checked by curl)
Connection between GitLab and Jira (checked by curl)


Has anyone encountered this problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions