Jen Evenson

01/25/2022, 6:35 PM
Hello! I am trying to create Jira issues using the JiraTask and got this error (full text in thread):
jira.exceptions.JIRAError: JiraError HTTP 400 url: <https://our_jira_url/rest/api/2/issue>
	text: expected Object containing a 'name' property
	response text = {"errorMessages":[],"errors":{"assignee":"expected Object containing a 'name' property"}}
The issue is that for jira_create options, you're passing this dict, which does not have a 'name' property for the assignee object.
options = {
            "project": project_name,
            "assignee": {"accountId": assignee},
            "issuetype": {"name": issue_type},
            "summary": summary,
            "description": description,
Do others successfully use the JiraTask with Jira Server? Was the JiraTask maybe only intended to be used with Jira Cloud (api/3/issue) and not Jira Server (api/2/issue)? I know that my company has one of the largest single-instance Jira applications in the world, and we have a bunch of customizations so I don't know if this is only an issue for us. I've asked our internal Jira team if this particular issue might be related to a customization but haven't heard back yet. If I add a 'name' property to the assignee object (
"assignee": {"accountId": assignee, 'name': assignee},
), JiraTask will work and correctly create a Jira ticket. I obviously don't know if changing that in your codebase would break JiraTask for other users...
[2022-01-24 15:35:32+0000] ERROR - prefect.TaskRunner | Task 'JiraTask': Exception encountered during task execution!  

Traceback (most recent call last):
  File "~/.pyenv/versions/myvenv/site-packages/prefect/engine/", line 880, in get_task_run_state
  File "~/.pyenv/versions/myvenv/site-packages/prefect/utilities/", line 467, in run_task_with_timeout
    return*args, **kwargs)  # type: ignore
  File "~/.pyenv/versions/myvenv/site-packages/prefect/utilities/", line 456, in method
    return run_method(self, *args, **kwargs)
  File "~/.pyenv/versions/myvenv/site-packages/prefect/tasks/jira/", line 141, in run
    created = jira.create_issue(options)
  File "~/.pyenv/versions/myvenv/site-packages/jira/", line 1448, in create_issue
    r = <|>(url, data=json.dumps(data))
  File "~/.pyenv/versions/myvenv/site-packages/jira/", line 198, in post
    return self.__verb("POST", str(url), data=data, json=json, **kwargs)
  File "~/.pyenv/versions/myvenv/site-packages/jira/", line 189, in __verb
    raise_on_error(response, verb=verb, **kwargs)
  File "~/.pyenv/versions/myvenv/site-packages/jira/", line 70, in raise_on_error
jira.exceptions.JIRAError: JiraError HTTP 400 url: <https://our_jira_url/rest/api/2/issue>
	text: expected Object containing a 'name' property
	response headers = {[snipped for corp privacy]}
	response text = {"errorMessages":[],"errors":{"assignee":"expected Object containing a 'name' property"}}

Kevin Kho

01/25/2022, 6:44 PM
Hi @Jen Evenson, thanks for the report. I’ve actually never come across someone using the Jira task here so I wouldn’t know unfortunately. I think the task was written for the v2 API judging by the last commit. I am a bit hesitant to recommend changing the task in the task library for now since there hasn’t been anyone commenting (unless you become sure this change is needed). I would recommend making a Github issue to record this, but suggest you create a sublclass in the meantime for you use case. Does that work for you?
👍 1