gioboa / jira-plugin

Jira plugin for VsCode
https://marketplace.visualstudio.com/items?itemName=gioboa.jira-plugin
MIT License
265 stars 41 forks source link

Error on Issue Creation - reporter: "Reporter is required" #182

Closed mbystrzak closed 1 year ago

mbystrzak commented 1 year ago

Hello,

This may be more of a question so I apologize in advance but I'm hitting a wall and looking for some guidance. I'm experiencing this error "Reporter is required" when I am attempting to create a new issue through this extension. I can do all other things with the extension, just not the issue creation.

I am inputting a "reporter" in through the command bar and it's allowing me to submit the request. It is replying with this http 400 error as I noted above. I've tried a bunch of things but I cannot figure out how to set this attribute in the vscode settings as there doesn't appear to be an attribute for it. I can see in the request that my accountid in a custom header, x-aaccountid.

Can you help guide me on how I might solve this issue?

gioboa commented 1 year ago

Hi @mbystrzak, do you have any log in the terminal? Here is a guide to look at the logs here

mbystrzak commented 1 year ago

I do, but I'm hesitant to post it because it has proprietary information in it. I grabbed the snippets that I felt were important in an effort to obfuscate the sensitive stuff. Is there specific things I might look for?

gioboa commented 1 year ago

Yes, sure you must delete all sensitive data. Is there any error message?

mbystrzak commented 1 year ago

yes, I noted it in my original post...

{"statusCode":400,"body":{"errorMessages":[],"errors":{"reporter":"Reporter is required."}}

That's the only error message.

gioboa commented 1 year ago

The fastest way to understand the problem is hack the plugin code. In this folder you have all installed extensions ~/.vscode/extensions If you open with text editor this file ~/.vscode/extensions/gioboa.jira-plugin-xx.xx.xx/out/src/services/issue-helper.service.ts You can debug the code with console.log because are visibile in VsCode dev tool - Help > Toggle Developer Tools you can log the payload at this line and check it

https://github.com/gioboa/jira-plugin/blob/05db0960eee536f45f855c126930e0d63a7c0cb2/src/services/issue-helper.service.ts#L337

in this method the plugin is going to create the issue

mbystrzak commented 1 year ago

@gioboa Excellent! Thanks for this. I will give this a go and see what I can do. I'll report back in the near future.

mbystrzak commented 1 year ago

OK. So I'm finding that I must have a different version of this plugin than what you're referencing. My issue-helper.service file only has 329 lines and the line you mentioned doesn't exist. The line I have looks like this...

const createdIssue = yield _1.store.state.jira.createIssue(payload);

Can you tell me where you are defining the reporter and pushing it into this method?

gioboa commented 1 year ago

Check this line https://github.com/gioboa/jira-plugin/blob/05db0960eee536f45f855c126930e0d63a7c0cb2/src/services/issue-helper.service.ts#LL170C7-L170C95

if (this.isAssigneeOrReporterField(fieldName)) {
  // assignee autoCompleteUrl sometimes don't work, I use custom one
  // this.preloadedListValues[fieldName] = await store.state.jira.customRequest('GET', field.autoCompleteUrl);
  this.preloadedListValues[fieldName] = await store.state.jira.getAssignees(this.project);
}
gioboa commented 1 year ago

type JIRA_PLUGIN_DEBUG_MODE In your current text editor and you will enable the debugMode to log extra info https://github.com/gioboa/jira-plugin/blob/05db0960eee536f45f855c126930e0d63a7c0cb2/src/services/logger.service.ts#LL22C25-L22C47 I didn't remember this piece of code 🤣

private debugMode() {
  const editor = vscode.window.activeTextEditor;
  if (editor && editor.document) {
    const text = editor.document.getText();
    if (text.indexOf('JIRA_PLUGIN_DEBUG_MODE') !== -1) {
      return true;
    }
  }
  return false;
}
gioboa commented 1 year ago
Screenshot 2023-03-02 at 18 23 34

we need to pass the id of the reporter. this is a screen from a Jira Web Application HTTP request


I created a Jira Test account because I don't use it anymore 🤣

gioboa commented 1 year ago
Screenshot 2023-03-02 at 18 52 31

if you clone the repo, install deps. then you could press F5 From VsCode (first instance) --> another instance of VsCode will be launched.(second instance). You can debug the second instance by the first one, breakpoint are available.

gioboa commented 1 year ago

@mbystrzak can you apply this fix in your extension code? let me know if it works.

UPDATE

Here I created the version 022.3-beta.0, let me know if it solves the issue jira-plugin-0.22.3-beta.0.vsix.zip

mbystrzak commented 1 year ago

Sorry for the delay. Things got away from me. This worked. I'd recommend pushing this into your production code so we can pull it from the store.

gioboa commented 1 year ago

Great 😃 I will create the new release soon. Please star ⭐ the repo, it means a lot to me 😉