go-jira icon indicating copy to clipboard operation
go-jira copied to clipboard

[issue] - Example "Create an Issue" Failing

Open naiduarvind opened this issue 4 years ago • 7 comments

Describe the bug

The example on "Create an Issue" runs into a panic with a status code: 400.

Formatting tips: GitHub supports Markdown: https://guides.github.com/features/mastering-markdown/

To Reproduce

Provide a link to a live example, or an unambiguous set of steps to reproduce this bug. Include configuration, logs, etc. to reproduce, if relevant.

  1. Simply copy the example from the README of the repository and paste it into an editor.
  2. Run the build to produce a target binary.
  3. Execute the target binary and you will be presented with the error seen below.
Screenshot 2020-08-09 at 11 16 05 PM

Expected behavior

The expected behavior should be that it creates the ticket and exits the program successfully.

Possible Solution

Removing the Reporter and Assignee field from the IssueFields creates the ticket as expected but another situation occurs. Apparently dereferencing the pointers from issue to i in the print statement causes another panic: runtime error: invalid memory address or nil pointer dereference as seen below.

Screenshot 2020-08-10 at 2 00 08 PM

Changing issues.Fields.Summary to i.Fields.Summary gets the entire example to be working as expected.

Your Environment

Include as many relevant details about the environment you experienced the problem in

  • go-jira version (git tag or sha): de60bbe
  • Go version (go version): go1.14.6 darwin/amd64
  • Jira version: I believe it is the latest since I can't seem to get the version tag off "Inspect Element"
  • Jira type (cloud or on-premise): Cloud
  • Involved Jira plugins: None
  • Operating System and version: Mac OS

naiduarvind avatar Aug 10 '20 06:08 naiduarvind

Hi! Thank you for taking the time to create your first issue! Really cool to see you here for the first time. Please give us a bit of time to review it.

github-actions[bot] avatar Aug 10 '20 06:08 github-actions[bot]

I'm experiencing a very similar issue except that I can use the Assignee field, just not the Reporter field.

Additionally, when I remove the Reporter field and use jc.Issue.Create(), the issue is created successfully with all fields populated as expected but the issue struct returned from the call has Fields = nil.

If it helps, my environment: go-jira version: 1.12.0 go version: go1.14 darwin/amd64 jira version: 8.3.2 Jira type: On-premise Involved Jira plugins: none OS and version: Mac OS Catalina 10.15.6

dac42 avatar Aug 13 '20 15:08 dac42

+1 I see the exact same behavior.

omerxx avatar Sep 01 '20 18:09 omerxx

Thank you for your issue your issue report. I appreciate your patience as we work to get a new maintainer up to speed to help out on this project.

ghostsquad avatar Sep 23 '20 16:09 ghostsquad

After looking at the Jira docs, it looks like they require an account id for assignee and reporter. Testing it out with the following snip worked:

Assignee: &jira.User{
    AccountID: "<A Jira User ID here>",
},
Reporter: &jira.User{
    AccountID: "<A Jira User ID here>",
},

trenton42 avatar Mar 26 '21 01:03 trenton42

The custom required fields in Jira project should also be checked as there's no generic form of it, and it could be different per each project.

For example, this is my company's project requirement image

which of course is not included in the generic example

tuannvm avatar Aug 30 '21 08:08 tuannvm

Hey,

I am very sorry that this issue has been open for a long time with no final solution. We work on this project in our spare time, and sometimes, other priorities take over. This is the typical open source dilemma.

However, there is news: We are kicking off v2 of this library 🚀

To provide visibility, we created the Road to v2 Milestone and calling for your feedback in https://github.com/andygrunwald/go-jira/issues/489

The development will take some time; however, I hope you can benefit from the changes. If you seek priority development for your issue + you like to sponsor it, please contact me.

What does this mean for my issue?

We will work on this issue indirectly. This means that during the development phase, we aim to tackle it. Maybe in a different way like it is currently handled. Please understand that this will take a while because we are running this in our spare time.

Final words

Thanks for using this library. If there is anything else you would like to tell us, let us know!

andygrunwald avatar Aug 21 '22 14:08 andygrunwald