Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.
 

Unable to integrate with JIRA


#1

Hi folks,

I am trying to integrate testrail with JIRA but getting the following error:

Plugin “Jira_REST” returned an error: Invalid HTTP code (401). Please check your user/password and that the REST API is enabled in Jira.

  1. I am not set up as an admin in JIRA if that could be an issue
  2. Do I need to request any special permission in JIRA?
  3. I have different logins for test rail (qa@<companyname.com>) and JIRA (my business email)

Would really appreciate your help here

Note: I did look up info on this error and checked if the remote API calls is enabled in JIRA (asked admin to verify this since I am not an admin user)


#2

Hello,

Thanks for your posting. This looks like a permission or authentication issue with the user you use for the JIRA integration. Please try to use your JIRA user name instead of the email address for the integration and this might already do the trick.

Regards,
Tobias


#3

Thanks Tobias! Realized I never thanked you for this. Used user name instead of email and it works like charm! :slight_smile:


#4

You are welcome and great to hear that it works now :slight_smile:

Regards,
Tobias


#5

Hi,

In Testrail i have added user variables ( jira_password and jira_user) under Administration > Integration . provided valid jira username and password in user variables. when i click on “ADD” in Add test result its opens Jira and asking for credentials to login. do i need to enter credentials every time ? any help here is appreciated. Thanks.

; Please configure your Jira connection below
[connection]
address=http://jira-test.abcd.com
user=%jira_user%
password=%jira_password%


#6

unable to “Push” from testrail , error shown on UI is “Plugin “Jira_REST” returned an error: couldn’t connect to host”

syslog:

18:27:36 [HttpException] couldn’t connect to host

Details:
File: /var/www/html/testrail/sys/helpers/ex.php
Line: 25
Status Code: 500
Host: 10.00.01.123
Uri: /testrail/index.php?/defects/ajax_prepare_push (POST)

Browser: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36
PHP: 5.3.3
Server: Linux 2.6.32-504.el6.x86_64 #1 SMP Wed Oct 15 04:27:16 UTC 2014 x86_64

status_id: 1
assignedto:
comment:
attachments:
version:
elapsed:
defects:
project_id: 3
test_ids: 15949
_token: 5709b01b0c12bbfa0dd0808128e0106d
_version: 4.0.3.3270

Trace:
at ex::raise (ex.php:25)
at ex::raise (http.php:219)
at http::request_ex (Jira_REST.php:1430)
at Jira_REST_api->_send_request (Jira_REST.php:1393)
at Jira_REST_api->_send_command (Jira_REST.php:958)
at Jira_REST_api->get_projects (Jira_REST.php:602)
at Jira_REST_defect_plugin->prepare_field (defects.php:623)
at Defects_controller->_prepare_form (defects.php:672)
at Defects_controller->ajax_prepare_push (controller.php:106)
at Controller->_invoke_web (controller.php:74)
at Controller->_invoke (gizmo.php:101)
at require_once (index.php:106)


#7

[quote=sekhar]Hi,

In Testrail i have added user variables ( jira_password and jira_user) under Administration > Integration . provided valid jira username and password in user variables. when i click on “ADD” in Add test result its opens Jira and asking for credentials to login. do i need to enter credentials every time ? any help here is appreciated. Thanks.

; Please configure your Jira connection below
[connection]
address=http://jira-test.abcd.com
user=%jira_user%
password=%jira_password%[/quote]

The Add functionality doesn’t use the plugin or those variables (if I understand it correctly), it just opens a new browser tab using the URL defined in the Administration tab. It will require a login the initial time, but each subsequent “add” will not. At least until the browser is closed.


#8

[quote=sekhar]unable to “Push” from testrail , error shown on UI is “Plugin “Jira_REST” returned an error: couldn’t connect to host”

syslog:

18:27:36 [HttpException] couldn’t connect to host[/quote]

This looks like the address for your JIRA instance is incorrect, or perhaps the REST API isn’t enabled in your JIRA instance. Make sure the ‘Allow Remote API Calls’ is turned on under Administration > General Configuration.


#9

Hello all,

This looks like a network or connection related issue. Please make sure that the TestRail server can establish a connection to JIRA (as the defect plugin requires a direct connection to JIRA’s API).

The Add feature is a simple link to your JIRA installation and uses your regular JIRA browser session.

Regards,
Tobias


#10

I’m also running into this error (Invalid HTTP code (401)). I read through the thread and confirmed the accounts info and the JIRA address, but still something is wrong. I’m getting the problem with the roll-over on JIRA defect IDs and the ‘Push’ URL for adding bugs into JIRA.

What I’ve confirmed:

  1. JIRA Admin/System - Accept remote API calls = on

  2. JIRA username (not email) and password are entered correctly for the TestRail user.

  3. Defect plugin set to Jira_REST

  4. The user variables are set to ‘jira_user’ and ‘jira_password’

  5. Fallback matches a JIRA user with correct access permissions (administrator just to be sure)

  6. The Plugin looks correct with

    [connection]
    address=https://xxxxx.atlassian.net/
    user=%jira_user%
    password=%jira_password%

With all these settings checked, I can’t get past:

Plugin "Jira_REST" returned an error: Invalid HTTP code (401). Please check your user/password and that the REST API is enabled in Jira.

Any ideas what I’m missing?

I just read Tobias’ previous comment again. I’m using JIRA cloud. Are there different connection dependencies between JIRA cloud and JIRA locally hosted? Since It’s just a URL, I don’t expect that to be the case.


#11

Hi @dromard2015,

Thanks for the feedback. The connection settings are correct for JIRA Cloud and there’s no difference to a local instance except for the “atlassian.net” part of the account of course. Just to keep it simple for the first step and rule our any configuration issues related to this, can you please try directly entering your JIRA login details as part of the configuration instead of the defect variable placeholder? Once you confirmed that this is working, I’m happy to help with the defect variable config. You can also email us a screenshot of your full Administration > Integration page to contact@gurock.com so we can help troubleshoot this (you can hide/remove the password first of course).

Thanks!


#12

Hi,

I am seeing the below error in the system log when i try to push a defect to JIRA. I have tried all the above suggestions.

[connection]
address=http://my-jira-server/
user=jira username (not email)
password=jira password

06:53:12 [Jira_RESTException] Invalid HTTP code (404). Please check your user/password and that the REST API is enabled in Jira.

Details:
File: C:\inetpub\wwwroot\testrail\app\plugins\defects\Jira_REST.php
Line: 1819
Status Code: 500
Host: end-hq-psc
Uri: /testrail/index.php?/defects/ajax_prepare_push (POST)

Browser: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36
PHP: 5.4.24
Server: Windows NT 6.2 build 9200 (Unknown Windows version Standard Edition) i586

status_id: 5
assignedto:
comment:
attachments:
version:
elapsed:
defects:
project_id: 1
test_ids: 338
_token: izViTDPw5cVtXpPUYfRT
_version: 4.2.0.3315

Trace:
at Jira_REST_api->_throw_error (Jira_REST.php:1476)
at Jira_REST_api->_send_request (Jira_REST.php:1419)
at Jira_REST_api->_send_command (Jira_REST.php:981)
at Jira_REST_api->get_projects (Jira_REST.php:625)
at Jira_REST_defect_plugin->prepare_field (defects.php:625)
at Defects_controller->_prepare_form (defects.php:674)
at Defects_controller->ajax_prepare_push (controller.php:215)
at Controller->_invoke_web_call (controller.php:127)
at Controller->_invoke_web (controller.php:76)
at Controller->_invoke (gizmo.php:107)
at require_once (index.php:106)


#13

After posting the issue found that the issue is with address i have mentioned. Now it is resolved and works excellent!

Thanks.


#14

That’s great to hear, Venkata!

Regards,
Tobias


#15

I am having a similar issue, TesrRail is not able to authenticate on our JIRA server. I did defined the jira_user and jira_password, but I am still getting an error. JIRA REST API is configured in our server.

Any other suggestions how to troubleshoot?

See logs below:

[E] 2015-06-26 13:46:43 [296ms]: [Jira_RESTException] Invalid HTTP code (302). Please check your user/password and that the REST API is enabled in Jira.

Details:
File: /var/www/testrail/app/plugins/defects/Jira_REST.php
Line: 1819
Status Code: 500
Host: testlink-bldr
Uri: /testrail/index.php?/defects/ajax_lookup (POST)

Browser: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Firefox/38.0
PHP: 5.3.2-1ubuntu4.19
Server: Linux 2.6.32-37-generic #81-Ubuntu SMP Fri Dec 2 20:32:42 UTC 2011 x86_64

project_id: 1
defect_id: BOACUTTST-613
_token: OSKRkdSe/eTOah/pmk3C
_version: 4.2.0.3315

Trace:
at Jira_REST_api->_throw_error (Jira_REST.php:1476)
at Jira_REST_api->_send_request (Jira_REST.php:1419)
at Jira_REST_api->_send_command (Jira_REST.php:1413)
at Jira_REST_api->get_issue (Jira_REST.php:780)
at Jira_REST_defect_plugin->lookup (defects.php:1128)
at Defects_controller->ajax_lookup (controller.php:215)
at Controller->_invoke_web_call (controller.php:127)
at Controller->_invoke_web (controller.php:76)
at Controller->_invoke (gizmo.php:107)
at require_once (index.php:106)


#16

Hello @mdesousa,

This error message returned by your JIRA server is a redirect and usually indicates a slightly wrong JIRA web address. Can you please send a screenshot of your configuration settings to us at contact@gurock.com? We are happy to recommend the change you need to make to get this working.

Thanks!


#17

Issue was resolved. After speaking with IT support, we got the proper URL where REST API was enabled. Integration is now working fine. Thanks

Márcio


#18

Great to hear that, Márcio!

Regards,
Tobias


#19

Hi Team,

I am trying to integrate testrail with JIRA but getting the following error:

I try to raise a defect when via Add Result. I am able to raise it. But it does not reflect in Results section.
Same issue when my team mate also raises defect.

When i click on the defect pushed by him, i get error message-
Plugin “Jira_REST” returned an error: Invalid user or password or insufficient permissions for the integration user (HTTP code 401). Please make sure to use your actual JIRA username for the integration (not your email address, for example).

I have got admin rights in TestRail but not an admin in JIRA
Do I need to request any special permission in JIRA?
I have logins for test rail (jobin) and JIRA (jobin)

Would really appreciate your help here


#20

Hi Jobin,

After pushing a defect with the Push Defect dialog, you also need to save the result with the JIRA issue ID in the Defects field. You would then see the defect in the TestRail: Results section in JIRA via the TestRail for JIRA add-on. The 401 error you see is an authentication issue and usually means that the username and/or password for the integration is not quite correct or that there’s a permissions issue with accessing the issue and/or project in JIRA. Can you check if the passwords are correct and that the JIRA users have permission to access the issue/project?

Cheers,
Tobias