Comments (11)
Could you try jira issue ls -p
?
Same error? And how many projects do you have?
from terjira.
I get a response from the server
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/json/common.rb:155:in `parse': 757: unexpected token at '<html> (JSON::ParserError)
I also get a 401, and a lot of Javascript as a response
from terjira.
It looks like I am running an old version of ruby, updating to 2.4.1 to see if that resolves any issues.
from terjira.
401 is unauthorized right? Could you try jira login
again?
from terjira.
I'm getting below error stack trace
▲ rubydock-container/apps/terjira bin/terjira issue new
Choose project? AP - Awesome Project
/Users/taufek/.asdf/installs/ruby/2.4.2/lib/ruby/gems/2.4.0/gems/tty-prompt-0.12.0/lib/tty/prompt/list.rb:209:in `block in validate_defaults'
/Users/taufek/.asdf/installs/ruby/2.4.2/lib/ruby/gems/2.4.0/gems/tty-prompt-0.12.0/lib/tty/prompt/list.rb:203:in `each'
/Users/taufek/.asdf/installs/ruby/2.4.2/lib/ruby/gems/2.4.0/gems/tty-prompt-0.12.0/lib/tty/prompt/list.rb:203:in `validate_defaults'
/Users/taufek/.asdf/installs/ruby/2.4.2/lib/ruby/gems/2.4.0/gems/tty-prompt-0.12.0/lib/tty/prompt/list.rb:195:in `setup_defaults'
/Users/taufek/.asdf/installs/ruby/2.4.2/lib/ruby/gems/2.4.0/gems/tty-prompt-0.12.0/lib/tty/prompt/list.rb:154:in `call'
/Users/taufek/.asdf/installs/ruby/2.4.2/lib/ruby/gems/2.4.0/gems/tty-prompt-0.12.0/lib/tty/prompt.rb:217:in `invoke_select'
/Users/taufek/.asdf/installs/ruby/2.4.2/lib/ruby/gems/2.4.0/gems/tty-prompt-0.12.0/lib/tty/prompt.rb:254:in `select'
/Users/taufek/containers/rubydock-container/apps/terjira/lib/terjira/option_support/option_selector.rb:80:in `block in select_issuetype'
/Users/taufek/containers/rubydock-container/apps/terjira/lib/terjira/option_support/resource_store.rb:19:in `fetch'
/Users/taufek/containers/rubydock-container/apps/terjira/lib/terjira/option_support/option_selector.rb:9:in `fetch'
/Users/taufek/containers/rubydock-container/apps/terjira/lib/terjira/option_support/option_selector.rb:72:in `select_issuetype'
/Users/taufek/containers/rubydock-container/apps/terjira/lib/terjira/option_supportable.rb:67:in `block in suggest_options'
/Users/taufek/containers/rubydock-container/apps/terjira/lib/terjira/option_supportable.rb:65:in `each'
/Users/taufek/containers/rubydock-container/apps/terjira/lib/terjira/option_supportable.rb:65:in `suggest_options'
/Users/taufek/containers/rubydock-container/apps/terjira/lib/terjira/issue_cli.rb:62:in `new'
/Users/taufek/.asdf/installs/ruby/2.4.2/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
/Users/taufek/.asdf/installs/ruby/2.4.2/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
/Users/taufek/.asdf/installs/ruby/2.4.2/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
/Users/taufek/.asdf/installs/ruby/2.4.2/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor/invocation.rb:115:in `invoke'
/Users/taufek/.asdf/installs/ruby/2.4.2/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor.rb:242:in `block in subcommand'
/Users/taufek/.asdf/installs/ruby/2.4.2/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
/Users/taufek/.asdf/installs/ruby/2.4.2/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
/Users/taufek/.asdf/installs/ruby/2.4.2/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
/Users/taufek/.asdf/installs/ruby/2.4.2/lib/ruby/gems/2.4.0/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
bin/terjira:10:in `<main>'
default index `1` out of range (1 - 0)
from terjira.
I think this is a problem in below method when the project has no issue types.
module Terjira
module OptionSelector
...
def select_issuetype
fetch(:issuetype) do
project = get(:issue).try(:project).try(:key)
project ||= select_project
if project.is_a? String
project = Client::Project.find(project)
set(:project, project)
end
# will throw an exception when project.issuetypes is empty
option_select_prompt.select('Choose issue type?') do |menu|
project.issuetypes.each do |issuetype|
menu.choice issuetype.name, issuetype
end
end
end
end
...
end
end
from terjira.
In Project client below it does include issueTypes
in the expand
query string. And issueTypes
query string is correct based on JIRA doc.
require_relative 'base'
module Terjira
module Client
# Project Client Baseed on jira-ruby gem
class Project < Base
class << self
delegate :all, :find, :fetch, to: :resource
def all
expand = %w(description lead issueTypes url projectKeys)
resp = api_get 'project', expand: expand.join(',')
resp.map { |project| build(project) }
end
...
end
end
end
end
But when I output the project
object seems like it does not include issueTypes
.
=> [#<JIRA::Resource::Project:0x00007fd616c69410
@attrs=
{"expand"=>"description,lead,url,projectKeys",
"self"=>"https://jira.pbww.org:8443/rest/api/2/project/10300",
"id"=>"10300",
"key"=>"AP",
"description"=>"",
"lead"=>
{"self"=>"https://jirahost.com/rest/api/2/user?username=system.admin",
"key"=>"system.admin",
"name"=>"system.admin",
"avatarUrls"=> {...},
"displayName"=>"System Admin",
"active"=>true},
"name"=>"Awesome Project",
"avatarUrls"=> {...},
"projectKeys"=>["AP"],
"projectTypeKey"=>"software"},
...
I'm running against on-premise JIRA installation for my company. We are running JIRA Software 7.3.3. Could it be due JIRA versioning issue?
from terjira.
I tried to call the API directly using client tool (insomnia), seems like the response does include issueTypes.
Request:
GET https://jira.pbww.org:8443/rest/api/2/project/10300
Response:
{
"expand": "description,lead,url,projectKeys",
"self": "https://jirahost.com/rest/api/2/project/10300",
"id": "10300",
"key": "AP",
"description": "",
"lead": {
"self": "https://jirahost.com/rest/api/2/user?username=system.admin",
"key": "system.admin",
"name": "system.admin",
"avatarUrls": {
...
},
"displayName": "System Admin",
"active": true
},
"components": [],
"issueTypes": [
{
"self": "https://jirahost.com/rest/api/2/issuetype/10002",
"id": "10002",
"description": "A task that needs to be done.",
"iconUrl": "https://jirahost.com/secure/viewavatar?size=xsmall&avatarId=10318&avatarType=issuetype",
"name": "Task",
"subtask": false,
"avatarId": 10318
},
{
"self": "https://jirahost.com/rest/api/2/issuetype/10003",
"id": "10003",
"description": "The sub-task of the issue",
"iconUrl": "https://jirahost.com/secure/viewavatar?size=xsmall&avatarId=10316&avatarType=issuetype",
"name": "Sub-task",
"subtask": true,
"avatarId": 10316
},
{
"self": "https://jirahost.com/rest/api/2/issuetype/10001",
"id": "10001",
"description": "gh.issue.story.desc",
"iconUrl": "https://jirahost.com/images/icons/issuetypes/story.svg",
"name": "Story",
"subtask": false
},
{
"self": "https://jirahost.com/rest/api/2/issuetype/10004",
"id": "10004",
"description": "A problem which impairs or prevents the functions of the product.",
"iconUrl": "https://jirahost.com/secure/viewavatar?size=xsmall&avatarId=10303&avatarType=issuetype",
"name": "Bug",
"subtask": false,
"avatarId": 10303
},
{
"self": "https://jirahost.com/rest/api/2/issuetype/10000",
"id": "10000",
"description": "gh.issue.epic.desc",
"iconUrl": "https://jirahost.com/images/icons/issuetypes/epic.svg",
"name": "Epic",
"subtask": false
}
],
"assigneeType": "UNASSIGNED",
"versions": [
...
],
"name": "Awesome Project",
"roles": {
...
},
"avatarUrls": {
...
},
"projectTypeKey": "software"
}
I'm not sure why yet when calling the rest api via ruby library it does not return issue types but when calling the rest api via api client tool it does return the issue types.
from terjira.
I think I found out the root cause. The difference between the ruby api call and the api client tool, is
in ruby api call we are calling list of projects, but with api client tool I'm calling individual project.
So when I'm calling list of project via api client tool it return list of projects without issue types.
[
{
"expand": "description,lead,url,projectKeys",
"self": "https://jirahost.com/rest/api/2/project/10300",
"id": "10300",
"key": "AP",
"name": "Awesome Project",
"avatarUrls": {
...
},
"projectTypeKey": "software"
},
{
"expand": "description,lead,url,projectKeys",
"self": "https://jirahost.com/rest/api/2/project/10138",
"id": "10138",
"key": "AAP",
"name": "Another Awesome Project",
"avatarUrls": {
...
},
"projectTypeKey": "software"
},
...
from terjira.
I've created a bug fix in #60.
from terjira.
Thanks @taufek
from terjira.
Related Issues (20)
- New issue creation error HOT 5
- Sprint Issues are not listing
- Is there a way to provide auth for Okta <-> JIRA ?
- Login with Personal Acces Token to server version
- Deprecation warning (Windows)
- request a new release
- Installed but command not found?
- Not working on macos
- Feature request: Edit description pre-populate existing value
- GDPR changes HOT 4
- Multiple accounts/instances support?
- [RFC] tempo plugin support?
- documentation update to indicate password is api token for some login workflows HOT 1
- Could not find command "__completion_bash"
- Edit points? HOT 1
- Migrate to latest stable versions of active support and thor HOT 5
- undefined method `name' for #<JIRA::Resource::User:0x00007fdbab0bb128> HOT 7
- undefined method `name' for #<JIRA::Resource::User:0x00007fdbab0bb128> HOT 3
- Add ability to persist login values HOT 2
- Basic authentication with passwords is deprecated HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from terjira.