-
Notifications
You must be signed in to change notification settings - Fork 411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JIRA::HTTPError: JIRA::HTTPError #332
Comments
I think it is probably caused by API changes - https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-user-privacy-api-migration-guide/#summary-of-changes. I was able to get data with using accountId and passing cookie directly (stolen from my browser): options = {
:accountId => 'UUID',
:password => 'password',
:site => 'URL',
:context_path => '',
:auth_type => :basic,
:use_cookies => true,
:additional_cookies => ['cloud.session.token=myCookie']
} I was able to get |
Thanks for quick response. I will update the script to use this method for creating connection and will close the ticket on success. |
I had a similar problem but the issue is atlassian have started turning off the basic auth that we use. See https://ecosystem.atlassian.net/browse/ACJIRA-1466 Instead you need to generate a API token and use that as the account password (instead of the real password) https://confluence.atlassian.com/cloud/api-tokens-938839638.html |
Thanks, will try that. @simi's method sadly didn't work for me. |
Hi there, I got the following email from Atlassian today. We use Jira Cloud Am getting the same HTTPError response, too (in 1.6.0). I enabled the pry debugging in request_client.rb and it returns: [1] pry(#<JIRA::HttpClient>)> response
=> #<Net::HTTPNotFound 404 readbody=true> Here is the code that I'm testing with jira_options = {
username: 'USERNAME_HERE',
password: 'API_KEY_HERE',
site: 'https://planetargon.atlassian.net',
auth_type: :basic,
}
jira_client = JIRA::Client.new(jira_options)
jira_client.Issue.find('PA-3700') Any suggestions? |
Looks like it works once I switched from passing JIRA our username to our email address. username: '[email protected]' works whereas username: 'robbyrussell' no longer worked |
I was able to confirm using api token instead of password worked. Thanks. |
✓ I can confirm too. It is working with replacing the password with API token. However, for me another pitfall was, that following this guides you need to login with the hooked up user rather than your own user. So instead of [email protected] it is [email protected] in our case. |
robbyrussell's change to use email + api_key works for me too! |
I think the bigger issue here is the obfuscation of the real error. Something like this would fix it. require 'forwardable'
module JIRA
class HTTPError < StandardError
extend Forwardable
def_instance_delegators :@response, :code
attr_reader :response, :my_message
def initialize(response)
@response = response
@my_message = response.try(:message) || response.try(:body)
super @my_message
end
end
end |
@toomanyjoes: |
@zhangyonguu you're saying that JIRA's API doesn't return messages on its API error responses? I'd have to look into that but it seems hard to believe. Maybe it returns a custom error and the descriptive message isn't where you're expecting it to be? In any case returning |
Hmmm. I got nothing from such a terrible error message 🤦♂️ |
I capture the while messages when initializing the JIRA::HTTPError object and send it to my sentry server so that I can figure out the error details. |
this may help. |
Hey everyone -- I know this message is old, but I've recently been doing some cleanup and preparing a new version. I believe there are two items here:
An example would be requesting an issue that doesn't exist, where you'll receive an begin
client.Issue.find('NOEXIST-2')
rescue => e
puts JSON.parse(e.response.body.inspect)
end Then you'll see the original message: {"errorMessages":["Issue does not exist or you do not have permission to see it."],"errors":{}} |
We have some scripts which we use for creating tasks in jira. But for couple of days i am getting following error
JIRA::HTTPError: JIRA::HTTPError
'from /var/lib/gems/2.3.0/gems/jira-ruby-1.6.0/lib/jira/request_client.rb:15:in
request' from /var/lib/gems/2.3.0/gems/jira-ruby-1.6.0/lib/jira/client.rb:238:in
request'from /var/lib/gems/2.3.0/gems/jira-ruby-1.6.0/lib/jira/client.rb:216:in
get' from /var/lib/gems/2.3.0/gems/jira-ruby-1.6.0/lib/jira/base.rb:95:in
all'from /var/lib/gems/2.3.0/gems/jira-ruby-1.6.0/lib/jira/base_factory.rb:31:in
block (2 levels) in delegate_to_target_class' from (irb):18 from /usr/bin/irb:11:in
Earlier i was using v1.4.3 but issue still persist after updating to v1.6.0.
I think it might be due to some changes in jira apis.
({
username: JiraAuth::USERNAME,
password: JiraAuth::PASSWORD,
site: JiraAuth::SITE,
context_path: '',
auth_type: :basic
} these are the parameters used for client.)
The text was updated successfully, but these errors were encountered: