Skip to content
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 integration 'Test Credentials' fails with 'Jira Request failed: searchJira - [object Object]' #1

Closed
jefft opened this issue Feb 7, 2017 · 15 comments

Comments

@jefft
Copy link

jefft commented Feb 7, 2017

It appears that establishing JIRA integration is broken. SP doesn't even issue a HTTP request.

To illustrate, start netcat listening on localhost:12345

root@jturner-desktop:~# nc -l 12345

Now enable JIRA integration with host http://localhost:12345

image

'nc' prints nothing, indicating that no HTTP request was received. SP reports an error:

image

The console does not report anything useful:

image

@johannesjo
Copy link
Owner

Thank you very much for reporting! I'll check this tomorrow!

@johannesjo
Copy link
Owner

johannesjo commented Feb 8, 2017

I'm having trouble finding the source, but my guess would be that it has to do with the port. node-jira which I'm using specifies this with an extra parameter. I will add another field to configure for the host, which will hopefully fix the issue I will try to to extract the port from the url .

@johannesjo
Copy link
Owner

Could you please check again?

@jefft
Copy link
Author

jefft commented Feb 9, 2017

No luck. I don't think it's just a port problem, because I get the same problem when entering 'http://redradish_jira.localhost' and 'https://issues.redradishtech.com' in the Host field (I also tried scheme-less, 'redradish_jira.localhost'). It's not even attempting a HTTP query. I hope I rebuilt SP properly. I've appended my rebuild commands at the end [1].

It could just be the node-jira library you're using that is broken. See the comment on steves/node-jira#131. For instance, I saved the following as testjira.js in your super-productivity/ directory (code straight from the README):

JiraApi = require('jira').JiraApi;

var jira = new JiraApi('http', 'redradish_jira.localhost', '80', 'jturner', 'REDACTED', '2.0.alpha1');
jira.findIssue('LLNW-12', function(error, issue) {
	    console.log('Issue: ' + issue);
});

and I get:

jturner@jturner-desktop:~/src/github.com/johannesjo/super-productivity$ npm list | grep jira
├─┬ [email protected] (git+https://github.com/johannesjo/node-jira.git#7eeab4fa175e32c5772f414e57036e1a13892572)
jturner@jturner-desktop:~/src/github.com/johannesjo/super-productivity$ node testjira.js 
Issue: undefined

I have better luck with 'node-client':

jturner@jturner-desktop:/tmp$ 
jturner@jturner-desktop:/tmp$ npm install jira-client
[email protected] node_modules/jira-client
├── [email protected] ([email protected], [email protected], [email protected])
└── [email protected] ([email protected], [email protected])
jturner@jturner-desktop:/tmp$ jirapass=<redacted>
jturner@jturner-desktop:/tmp$ cat > testjira.js <<EOF
JiraApi = require('jira-client');
var jira = new JiraApi({protocol: 'http', host: 'redradish_jira.localhost', port: '80', username: 'jturner', password: '$jirapass', apiVersion: '2'});
jira.findIssue('TODO-12').then(function(issue) { console.log('Issue ID: ', issue.id);})
.catch(function(err) {
	console.error(err);
});
EOF
jturner@jturner-desktop:/tmp$ node testjira.js 
Issue ID:  22100

[1] How I rebuilt:

root@jturner-desktop:~/src/github.com/johannesjo/super-productivity# git pull
...
root@jturner-desktop:~/src/github.com/johannesjo/super-productivity# git status
On branch develop
Your branch is up-to-date with 'origin/develop'.
nothing to commit, working directory clean
jturner@jturner-desktop:~/src/github.com/johannesjo/super-productivity$ npm install -g electron node-gyp gulp bower
jturner@jturner-desktop:~/src/github.com/johannesjo/super-productivity$ npm install && bower install
npm WARN package.json [email protected] license should be a valid SPDX license expression
npm WARN deprecated [email protected]: Use vinyl-fs.symlink (or gulp.symlink with gulp 4) instead.
npm WARN engine [email protected]: wanted: {"node":">=6.9.x"} (current: {"node":"4.5.0","npm":"2.15.9"})
npm WARN engine [email protected]: wanted: {"node":">= 6.9.x"} (current: {"node":"4.5.0","npm":"2.15.9"})
npm WARN engine [email protected]: wanted: {"node":">= 6.9.0"} (current: {"node":"4.5.0","npm":"2.15.9"})
npm WARN engine [email protected]: wanted: {"node":">=6.9.x"} (current: {"node":"4.5.0","npm":"2.15.9"})
npm WARN engine [email protected]: wanted: {"node":">=6.9.x"} (current: {"node":"4.5.0","npm":"2.15.9"})
[email protected] node_modules/jira
├── [email protected]
└── [email protected]
...
jturner@jturner-desktop:~/src/github.com/johannesjo/super-productivity$ gulp build
...
[16:56:17] Finished 'build' after 28 s
jturner@jturner-desktop:~/src/github.com/johannesjo/super-productivity$ pkill electron
jturner@jturner-desktop:~/src/github.com/johannesjo/super-productivity$ pkill node
jturner@jturner-desktop:~/src/github.com/johannesjo/super-productivity$ npm start &

@johannesjo
Copy link
Owner

Thank you very much for digging into it. May I ask which version of node you are using? Does it work when using the compiled version of the app?

If not I will give switching to jira-client a go. If the API is similar to node-jira, than this shouldn't be too much trouble.

@jefft
Copy link
Author

jefft commented Feb 9, 2017

I was using node 4.5.0. I've just upgraded to node 6.9.5 and tried again, with no difference:

root@jturner-desktop:~/src/github.com/johannesjo/super-productivity# node --version
v6.9.5
root@jturner-desktop:~/src/github.com/johannesjo/super-productivity# npm list | grep jira
├─┬ [email protected] (git+https://github.com/johannesjo/node-jira.git#7eeab4fa175e32c5772f414e57036e1a13892572)
root@jturner-desktop:~/src/github.com/johannesjo/super-productivity# node testjira.js 
Issue: undefined

It also failed with the Debian-packaged version, superProductivity_1.0.0_amd64.deb.

Thanks for looking into it!

@johannesjo
Copy link
Owner

It's weird that it also fails with the debian package. I switched from node-jira to a personal fork from jira-client (a fork because some things do not work, as they should). I would hope that it fixes the issue. Can you try once more?

@jefft
Copy link
Author

jefft commented Feb 10, 2017

I've tried again - unfortunately no difference. Clicking Test Credentials still results in 'Jira Request failed: searchJira - [object Object]'.

I noticed that if I ignore the 'Test Credentials' error and switch to the Daily Planner, the SP does issue JIRA requests. In my case it breaks either due to use of http or self-signed https, but those are separate problems which I've logged as #4 and #5 respectively. Were those bugs fixed or were I to use a properly signed https URL, JIRA integration might well work. I'll modify this ticket to make it specifically about 'Test Connection' failing.

It would be very interesting to know if anyone else gets this "Jira Request failed: searchJira - [object Object]" message on 'Test Connection', or if there's just something weird about my setup. Rather than spend more time, perhaps let this issue sit until anyone can confirm/deny?

I tried briefly to debug it myself, but I've never used NodeJS before and got lost in Promise/Callback hell. I got to the breakpoint where 'Connection failed!' is shown, only to find the Jira object is now out of scope.

image

@jefft jefft changed the title JIRA integration not working JIRA integration 'Test Credentials' fails with 'Jira Request failed: searchJira - [object Object]' Feb 10, 2017
@jefft
Copy link
Author

jefft commented Feb 12, 2017

Testing with the latest (d5ba4f...) incorporating the http fix (#4), I still get the "Jira Request failed: searchJira - [object Object]" when testing (self-signed) HTTPS but 'http://redradish_jira.localhost' now works. So perhaps it was the self-signed cert problem (#5) all along, and the error isn't appearing in the console or anywhere.

@johannesjo
Copy link
Owner

johannesjo commented Feb 12, 2017

Thanks for checking again! Does setting NODE_TLS_REJECT_UNAUTHORIZED='0' fix this issue?

@jefft
Copy link
Author

jefft commented Feb 13, 2017

Unfortunately no - with NODE_TLS_REJECT_UNAUTHORIZED='0' I still get "Jira Request failed: searchJira - [object Object]" with URL 'https://issues.redradishtech.com' both when clicking 'Test Credentials' and when switching to the daily planner. I'm happy for now using HTTP.

With 'http://redradish_jira.localhost' I got 'Connection Success', and happy Apache logs:

redradish_jira.localhost:80 127.0.0.1 10ipx5r jturner [13/Feb/2017:10:35:19 +1100] "POST /rest/api/latest/search HTTP/1.1" 200 509576 "-" "-" 520367

but I don't see any extra tasks, and creating a new task doesn't result in HTTP requests. What is the JIRA integration meant to achieve? I know that the JQL is returning issues, because I can see them from the command-line:

curl  -u jturner:$PASS -X POST -H "Content-Type: application/json" \
    --data '{"jql":"resolution = Unresolved ORDER BY updatedDate DESC","startAt":0,"maxResults":5000,"fields":["id","key"]}' \
     http://redradish_jira.localhost/rest/api/2/search   | jq '.issues[] | .key'
"TODO-32"
"TODO-12"
"LL-123"
...

@johannesjo
Copy link
Owner

johannesjo commented Feb 13, 2017

I realize that I did a very bad job in communicating how an useful application of the Jira (and now also git issue-) integration could look like and need to do a much better job at it (and maybe rethink how it is currently implemented).

My personal workflow for Jira projects looks like this:

  1. I start on the daily planning page. Creating non jira tasks and importing jira tasks by adding the ticket number into the upper input field. Once selected from the auto suggestions on enter key press a jira task is imported. If it is a bigger more complex Jira task, I start creating sub tasks to outline my intended workflow.

  2. With the imported task I've several features available, I get notified on remote changes and additions to the ticket (without having to browse thousand jira notification emails, which I usually just delete), I can (auto) update the status of the ticket once I start or complete it and I can use time tracking to add work logs (might need to be enabled in the configuration first). It's also possible to update the remote description of the issue, by updating the local version (might also need to enabled in the settings).

Adding tasks on Jira from the app is not implemented currently. Apart from the complexity of including the specific individual configuration for that, this is so because for my personal workflow this hasn't been a use case so far, as this is done in some sprint planning and possibly also by someone else. You could say that from the current point of view every planning for the team as a whole is still intended to be done with the Jira interface. Super Productivity is then used for your personal daily organization and time tracking.

I don't know if this makes much sense to you. I'm really curious to hear your thoughts about it!

EDIT: Thinking about it adding all tasks assigned to the current user automatically might be a really useful feature.

@jefft
Copy link
Author

jefft commented Feb 15, 2017

Neat! I was expecting SP to start bulk-importing all my issues as tasks, and attempting to do two-way synchronization. But your model of linking an issue to a task as-needed, and creating worklogs from subtasks seems pretty good. I'm going to try using it seriously over the next few days and see how I go. Thanks for all your help so far.

@johannesjo
Copy link
Owner

I'm really happy to hear that! Looking forward to hear your thoughts about it! Thank you very much for all your effort so far.

Btw. I also implemented the option to Bulk import. Needs a little fine tuning, but the basic functionality is there.

@johannesjo
Copy link
Owner

I close this for now. Feel free to reopen, if the error occurs again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants