Closed maxandersen closed 9 years ago
This is still happening ;/
@henvic can you investigate this?
Can you please assign this issue to me, @zenorocha?
@maxandersen, meanwhile you can try to add the following key structure to your .gh.json:
{
...
"plugins": {
"jira": {
"user": "your-username",
"password": "hash"
}
}
}
@henvic your pointers got me a bit further:
Here is what I did, I added:
"plugins": {
"jira": {
"user": "maxandersen",
"password": "hash"
}
},
And yes, I literally wrote hash
here since I was not sure what hashing you wanted applied ;)
With that in the file I ran gh jira
and got the following output:
% gh jira ~
[?] Enter your JIRA user: maxandersen
[?] Enter your JIRA password: ********
gh [success] Writing GH config data: /Users/max/.gh.json
and the resulting .gh.json now has:
"plugins": {
"jira": {
"user": "maxandersen",
"password": "nowwitharealhash"
}
},
..and this time I did not paste the real hash :)
Now when I run gh jira
I get this though:
% gh jira ~
/usr/local/lib/node_modules/gh-jira/bin/jira.js:262
.component = options.component || jiraConfig.default_issue_component[options.p
^
TypeError: Cannot read property 'undefined' of undefined
at instance.searchUserByGithubUsername_.instance.selectUserWithQuestion_.options.assignee (/usr/local/lib/node_modules/gh-jira/bin/jira.js:262:88)
at /usr/local/lib/node_modules/gh-jira/node_modules/async/lib/async.js:551:21
at /usr/local/lib/node_modules/gh-jira/node_modules/async/lib/async.js:227:13
at iterate (/usr/local/lib/node_modules/gh-jira/node_modules/async/lib/async.js:134:13)
at /usr/local/lib/node_modules/gh-jira/node_modules/async/lib/async.js:145:25
at /usr/local/lib/node_modules/gh-jira/node_modules/async/lib/async.js:229:17
at /usr/local/lib/node_modules/gh-jira/node_modules/async/lib/async.js:556:34
at /usr/local/lib/node_modules/gh-jira/bin/jira.js:258:17
at /usr/local/lib/node_modules/gh-jira/bin/jira.js:152:25
at /usr/local/lib/node_modules/gh-jira/node_modules/async/lib/async.js:232:13
So one step better but things still not working ;/
@maxandersen I've made few changes to the core and maybe this issue doesn't exist anymore (or things can be worse, but we're in the right direction now -- adding unit tests, modularizing, and so on). Can you please update and verify if this is still happening?
Best regards, Henrique.
okey - I reinstalled gh jira including updating to require node 0.12.
Now I get this when running 'gh':
/usr/local/lib/node_modules/gh/lib/base.js:31
host: baseConfig.api.host,
^
TypeError: Cannot read property 'api' of undefined
at Object.<anonymous> (/usr/local/lib/node_modules/gh/lib/base.js:31:21)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/usr/local/lib/node_modules/gh/lib/cmd.js:15:12)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
and when running gh jira
~ ❯❯❯ gh jira
? May gh anonymously report usage statistics to improve the tool over time? Yes
First we need authorization to use GitHub's API. Login with your GitHub account.
? Enter your GitHub user: maxandersen
? Enter your GitHub password: **********
? Enter your two-factor code: 780276
Writing GH config data: /Users/max/.gh.json
Authentication succeed.
/usr/local/lib/node_modules/gh-jira/bin/jira.js:209
options.assignee = options.assignee || jiraConfig.user;
^
TypeError: Cannot read property 'user' of undefined
at Jira.run (/usr/local/lib/node_modules/gh-jira/bin/jira.js:209:54)
at /usr/local/lib/node_modules/gh/lib/cmd.js:205:34
at Array.forEach (native)
at /usr/local/lib/node_modules/gh/lib/cmd.js:196:25
at /usr/local/lib/node_modules/gh/node_modules/async/lib/async.js:254:17
at /usr/local/lib/node_modules/gh/node_modules/async/lib/async.js:157:25
at /usr/local/lib/node_modules/gh/node_modules/async/lib/async.js:251:21
at /usr/local/lib/node_modules/gh/node_modules/async/lib/async.js:615:34
at /usr/local/lib/node_modules/gh/lib/cmds/user.js:192:33
at /usr/local/lib/node_modules/gh/node_modules/github/api/v3.0.0/authorization.js:141:17
so no, looks like same/worse situation.
FYI: I ran 'sudo npm install --force -g gh gh-jira' and still same error.
Okey - I think I might have a clue now. I get the above error when running it outside a git repository.
When running inside a git repo I get this instead:
warning: Can't hash jira password.
? Enter your JIRA user: maxandersen
? Enter your JIRA password: ********
Writing GH config data.
fatal: Can't transition. 401: Error while updating
now that I got this far - where does one configure the jira server ? it does not say anywhere in the readme. My guess for why I get a 401 is that it does not know what jira server to use ?
Figured out to add 'host' manually to ~/.gh.json.
without this or when running outside git repository it just fails hard.
submitted https://github.com/node-gh/gh-jira/pull/51 to update readme.md to let users at least get started.
Thanks for your pull request.
I just tried again. Removed gh jira and reinstalled it. Removed ~/.gh.json and here are what I get when running gh:
So that works. now run
gh jira
Thus yeah, something is assuming jiraConfig exists before jiraConfig is even added.