500 Unable to retrieve create meta data for project XXX Issue type 10268

Getting the following error when creating a task in Shotgun (manually using the web interface). The integration was working fine a few days ago. I dont recall changing anything in Jira and shotgun.

Local variables at outer most frame in plugin:

{‘dispatch_routes’: {72: ‘https://XXXXX/sg2jira/default’},
‘entity_id’: 5962,
‘entity_type’: ‘Task’,
‘event’: {‘attribute_name’: ‘sg_sync_in_jira’,
‘created_at’: datetime.datetime(2020, 9, 23, 11, 53, 5, tzinfo=<shotgun_api3.lib.sgtimezone.LocalTimezone object at 0x7f0385a180d0>),
‘entity’: {‘id’: 5962, ‘name’: ‘MBK_TEST_1’, ‘type’: ‘Task’},
‘event_type’: ‘Shotgun_Task_Change’,
‘id’: 479546,
‘meta’: {‘attribute_name’: ‘sg_sync_in_jira’,
‘entity_id’: 5962,
‘entity_type’: ‘Task’,
‘field_data_type’: ‘checkbox’,
‘new_value’: True,
‘old_value’: False,
‘type’: ‘attribute_change’},
‘project’: {‘id’: 72, ‘name’: ‘Demo: Game’, ‘type’: ‘Project’},
‘session_uuid’: ‘XX14a80-fdcdXX-11ea-86X80-0242ac110003XXX’,
‘type’: ‘EventLogEntry’,
‘user’: {‘id’: 121,
‘name’: ‘XXXX’,
‘type’: ‘HumanUser’}},
‘logger’: <logging.Logger object at 0x7f0384f4f4d0>,
‘meta’: {‘attribute_name’: ‘sg_sync_in_jira’,
‘entity_id’: 5962,
‘entity_type’: ‘Task’,
‘field_data_type’: ‘checkbox’,
‘new_value’: True,
‘old_value’: False,
‘type’: ‘attribute_change’},
‘payload’: {‘entity_id’: 5962,
‘entity_type’: ‘Task’,
‘meta’: {‘attribute_name’: ‘sg_sync_in_jira’,
‘entity_id’: 5962,
‘entity_type’: ‘Task’,
‘field_data_type’: ‘checkbox’,
‘new_value’: True,
‘old_value’: False,
‘type’: ‘attribute_change’},
‘project’: {‘id’: 72, ‘name’: ‘Demo: Game’, ‘type’: ‘Project’},
‘session_uuid’: '‘XX14a80-fdcdXX-11ea-86X80-0242ac110003XXX’,
‘user’: {‘id’: 121,
‘name’: ‘XXX’,
‘type’: ‘HumanUser’}},
‘project’: {‘id’: 72, ‘name’: ‘Demo: Game’, ‘type’: ‘Project’},
‘response’: <Response [500]>,
‘sg’: <shotgun_api3.shotgun.Shotgun object at 0x7f0384fa7790>,
‘sync_server_url’: ‘https://XXXX/sg2jira/default’,
‘sync_url’: ‘https://XXXX/sg2jira/default/Task/5962’}

2 Likes

Hey @mbk! Flagged this to the team to give a look. :slight_smile:

2 Likes

Hi @mbk,

Was there also a Python traceback outlining program files and line numbers that came along with the error you’ve quoted above?

This looks like it is an Even Daemon plugin included in the Shotgun to Jira sync workflow that crashed on a particular event. A traceback would help us understand what happened.

Thanks

3 Likes

Webapp Output:

2020-09-23 12:22:16,472 INFO [shotgun_session] Connected to https://xxxx.shotgunstudio.com.
2020-09-23 12:22:18,017 INFO [entity_issue_handler] Creating Jira Issue in Project FIA for Shotgun Task ‘MBK_TEST_1’ (5962)
2020-09-23 12:22:18,212 ERROR [bridge] Unable to retrieve create meta data for Project FIA Issue type 10268.
Traceback (most recent call last):
File “/xxxx/SG_Jira/sg-jira-bridge/sg_jira/bridge.py”, line 354, in sync_in_jira
entity_type, entity_id, safe_event
File “/xxx/SG_Jira/sg-jira-bridge/sg_jira/handlers/enable_syncing_handler.py”, line 94, in process_shotgun_event
entity_type, entity_id, event,
File “/xxx/SG_Jira/sg-jira-bridge/sg_jira/handlers/task_issue_handler.py”, line 228, in process_shotgun_event
“originalEstimate”: “%d m” % (sg_entity[“est_in_mins”] or 0)
File “/xxxx/SG_Jira/sg-jira-bridge/sg_jira/handlers/entity_issue_handler.py”, line 232, in _create_jira_issue_for_entity
return self._jira.create_issue_from_data(jira_project, issue_type, data,)
File “/xxx/SG_Jira/sg-jira-bridge/sg_jira/jira_session.py”, line 529, in create_issue_from_data
% (jira_project, jira_issue_type.id,)
RuntimeError: Unable to retrieve create meta data for Project FIA Issue type 10268.
2020-09-23 12:22:18,213 ERROR [webapp] 192.xx.1.xx - /sg2jira/default/Task/5962 - code 500, message Unable to retrieve create meta data for Project FIA Issue type 10268.

Daemon Output: (just created a new task )
INFO:plugin.sg_jira_event_trigger:Adding event id 479598 to backlog.
DEBUG:plugin.sg_jira_event_trigger:Dispatching event 479600 to callback process_event.
DEBUG:plugin.sg_jira_event_trigger.process_event:Processing {‘attribute_name’: ‘color’, ‘event_type’: ‘Shotgun_Task_Change’, ‘created_at’: datetime.datetime(2020, 9, 24, 8, 47, 54, tzinfo=<shotgun_api3.lib.sgtimezone.LocalTimezone object at 0x7fa8d0fdd0d0>), ‘entity’: {‘type’: ‘Task’, ‘id’: 5992, ‘name’: ‘mbktest’}, ‘project’: {‘type’: ‘Project’, ‘id’: 72, ‘name’: ‘Demo: Game’}, ‘meta’: {‘entity_id’: 5992, ‘attribute_name’: ‘color’, ‘in_create’: True, ‘entity_type’: ‘Task’, ‘old_value’: None, ‘new_value’: ‘pipeline_step’, ‘field_data_type’: ‘color’, ‘type’: ‘attribute_change’}, ‘user’: {‘type’: ‘HumanUser’, ‘id’: 121, ‘name’: ‘Muhammad Bin Khalid’}, ‘session_uuid’: ‘xx-fdd4-11ea-xx-0242ac11xx03’, ‘type’: ‘EventLogEntry’, ‘id’: 479600}
INFO:plugin.sg_jira_event_trigger.process_event:Retrieving sync routing for Project 72
DEBUG:plugin.sg_jira_event_trigger.process_event:Posting to https://xxx.ngrok.io/admin/reset
DEBUG:plugin.sg_jira_event_trigger.process_event:Jira Bridge reset.
DEBUG:plugin.sg_jira_event_trigger.process_event:Posting event {‘entity_id’: 5992, ‘attribute_name’: ‘color’, ‘in_create’: True, ‘entity_type’: ‘Task’, ‘old_value’: None, ‘new_value’: ‘pipeline_step’, ‘field_data_type’: ‘color’, ‘type’: ‘attribute_change’} to https://xxx.ngrok.io/sg2jira/default/Task/5992
DEBUG:plugin.sg_jira_event_trigger.process_event:Event successfully processed.
DEBUG:plugin.sg_jira_event_trigger:Dispatching event 479601 to callback process_event.
DEBUG:plugin.sg_jira_event_trigger.process_event:Processing {‘attribute_name’: ‘content’, ‘event_type’: ‘Shotgun_Task_Change’, ‘created_at’: datetime.datetime(2020, 9, 24, 8, 47, 54, tzinfo=<shotgun_api3.lib.sgtimezone.LocalTimezone object at 0x7fa8d0fdd0d0>), ‘entity’: {‘type’: ‘Task’, ‘id’: 5992, ‘name’: ‘mbktest’}, ‘project’: {‘type’: ‘Project’, ‘id’: 72, ‘name’: ‘Demo: Game’}, ‘meta’: {‘entity_id’: 5992, ‘attribute_name’: ‘content’, ‘in_create’: True, ‘entity_type’: ‘Task’, ‘old_value’: None, ‘new_value’: ‘mbktest’, ‘field_data_type’: ‘text’, ‘type’: ‘attribute_change’}, ‘user’: {‘type’: ‘HumanUser’, ‘id’: 121, ‘name’: 'xxx '}, ‘session_uuid’: ‘c745660a-fdd4-11ea-8c34-0242ac110003’, ‘type’: ‘EventLogEntry’, ‘id’: 479601}
DEBUG:plugin.sg_jira_event_trigger.process_event:Posting event {‘entity_id’: 5992, ‘attribute_name’: ‘content’, ‘in_create’: True, ‘entity_type’: ‘Task’, ‘old_value’: None, ‘new_value’: ‘mbktest’, ‘field_data_type’: ‘text’, ‘type’: ‘attribute_change’} to https://xxx.ngrok.io/sg2jira/default/Task/5992
CRITICAL:plugin.sg_jira_event_trigger.process_event:An error occured processing an event.

Traceback (most recent call last):
File “./src/shotgunEventDaemon.py”, line 1117, in process
self._callback(self._shotgun, self._logger, event, self._args)
File “/xxx/SG_Jira/sg-jira-bridge/triggers/sg_jira_event_trigger.py”, line 173, in process_event
response.raise_for_status()
File “/xxx/.local/lib/python2.7/site-packages/requests/models.py”, line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
HTTPError: 500 Server Error: Unable to retrieve create meta data for Project FIA Issue type 10268. for url: https://xxx.ngrok.io/sg2jira/default/Task/5992

2 Likes

Hi @mbk,

It looks like your Jira server is not returning values that are expected by the bridge. This could potentially be a project or user configuration issue. Although I’m not sure why it would stop working all of a sudden.

First, could you confirm that my suspicion is in fact correct by logging into the Jira account that the bridge uses (the one that is set in your environment variable SGJIRA_JIRA_USER) and trying to load this URL

https://<your.jira.site>/rest/api/2/issue/createmeta?projectKeys=FIA&issuetypeIds=10268&expand=projects.issuetypes.fields

you should get a response that has a structure like this

{
    ...
    "projects": [
        {
            ...
            "issueTypes": [ ... ]
        }
    ]
}

Judging from the error you posted, it looks like the response you get does not have the correct structure. You’re likely getting an empty projects list like this

{"expand":"projects","projects":[]}
3 Likes

The response is not empty. Heres the output from the above URL:

{“expand”:“projects”,“projects”:[{“expand”:“issuetypes”,“self”:“https://xxx.atlassian.net/rest/api/2/project/xx",“id”:“xx”,“key”:“FIA”,“name”:“xxxx”,“avatarUrls”:{“48x48”:“https://xxx.atlassian.net/secure/projectavatar?pid=xx&avatarId=xx”,“24x24”:“https://xxx.atlassian.net/secure/projectavatar?size=small&s=small&pid=xx&avatarId=xxx”,“16x16”:“https://xxx.atlassian.net/secure/projectavatar?size=xsmall&s=xsmall&pid=xx&avatarId=xx”,“32x32”:“https://xx.atlassian.net/secure/projectavatar?size=medium&s=medium&pid=xx&avatarId=xx”},"issuetypes”:}]}

1 Like

Based on that response I’m guessing the Jira project is not set up for the issue type you’ve configured the bridge for.

First, take a look at this line in your settings to see what issue type the bridge is trying to create.

Then go to your project in Jira and make sure you can create an issue with that type.

2 Likes

The Issue Type is Task in the setting.py. I manually created a Task ticket in Jira Project and it was successful.
As mentioned earlier, the integration was working totally fine and suddenly it stopped working. Nothing was changes and I verified the Integration again (i.e all parameters and config.)

1 Like

I’ll have to see if I can replicate this on my end to figure out why it’s happening. But the http request
from a couple of posts ago is asking the Jira server to return the info on the Task issue type the user can create on the FIA project. As you can see in the response, the issue_type array is empty which means the issue type is not valid.

The only thing I can think of is that the ID 10268 doesn’t actually match the Task issue type. But that’s figured out dynamically so it should be fine.

In the mean time, could you run the request again without specifying the issue type to see if there are any valid options?

https://<your.jira.site>/rest/api/2/issue/createmeta?projectKeys=FIA&expand=projects.issuetypes.fields
2 Likes

Yes, it has more than 1 option.

{“expand”:“projects”,“projects”:[{“expand”:“issuetypes”,“self”:“[https://xxx.atlassian.net/rest/api/2/project/xx",“id”:“xxx”,“key”:“FIA”,“name”:“xxxx”,“avatarUrls”:{“48x48”:“https://xx.atlassian.net/secure/projectavatar?pid=10450&avatarId=xxx”,“24x24”:“https://xxx.atlassian.net/secure/projectavatar?size=small&s=small&pid=xx&avatarId=xxx”,“16x16”:“https://xxx.atlassian.net/secure/projectavatar?size=xsmall&s=xsmall&pid=10450&avatarId=xxx”,“32x32”:“https://xxxx.atlassian.net/secure/projectavatar?size=medium&s=medium&pid=xxx&avatarId=xxx”},“issuetypes”:{“self”:“https://xxx.atlassian.net/rest/api/2/issuetype/10001”,“id”:“10001”,“description”:"A task that needs to be done.”,“iconUrl”:“https://xxx.atlassian.net/secure/viewavatar?size=medium&avatarId=xxx&avatarType=issuetype",“name”:“Task”,“untranslatedName”:“Task”,“subtask”:false,“expand”:“fields”,“fields”:{“summary”:{“required”:true,“schema”:{“type”:“string”,“system”:“summary”},“name”:“Summary”,“key”:“summary”,“hasDefaultValue”:false,“operations”:[“set”]},“issuetype”:{“required”:true,“schema”:{“type”:“issuetype”,“system”:“issuetype”},“name”:"Issue Type”,“key”:“issuetype”,“hasDefaultValue”:false,“operations”:,“allowedValues”:[{“self”:“https://xxxx.atlassian.net/rest/api/2/issuetype/10001",“id”:“10001”,“description”:"A task that needs to be done.”,“iconUrl”:"[https://xxxx.atlassian.net/secure/viewavatar?size=medium&avatarId=xxx&avatarType=issuetype",“name”:“Task”,“subtask”:false,“avatarId”:xxx}]},“description”:{“required”:false,“schema”:{“type”:“string”,“system”:“description”},“name”:“Description”,“key”:“description”,“hasDefaultValue”:false,“operations”:[“set”]},“project”:{“required”:true,“schema”:{“type”:“project”,“system”:“project”},“name”:“Project”,“key”:“project”,“hasDefaultValue”:false,“operations”:[“set”],“allowedValues”:{“self”:“https://xxx.atlassian.net/rest/api/2/project/xx”,“id”:“xxx”,“key”:“FIA”,“name”:"xxx “,“projectTypeKey”:“software”,“simplified”:false,“avatarUrls”:{“48x48”:“[https://xxx.atlassian.net/secure/projectavatar?pid=xxx&avatarId=xx”,“24x24”:“https://xxx.atlassian.net/secure/projectavatar?size=small&s=small&pid=xxx&avatarId=xxx”,“16x16”:“https://xxx.atlassian.net/secure/projectavatar?size=xsmall&s=xsmall&pid=xxx&avatarId=xxx”,“32x32”:“https://xxx.atlassian.net/secure/projectavatar?size=medium&s=medium&pid=xxx&avatarId=xxx”}}]},“priority”:{“required”:false,“schema”:{“type”:“priority”,“system”:“priority”},“name”:“Priority”,“key”:“priority”,“hasDefaultValue”:true,“operations”:[“set”],“allowedValues”:{“self”:“https://xxx.atlassian.net/rest/api/2/priority/1”,“iconUrl”:“https://xxx.atlassian.net/images/icons/priorities/critical.svg”,“name”:“Highest”,“id”:“1”},{“self”:“https://xxx.atlassian.net/rest/api/2/priority/2”,“iconUrl”:“https://xxxx.atlassian.net/images/icons/priorities/major.svg”,“name”:“High”,“id”:“2”},{“self”:“https://xxx.atlassian.net/rest/api/2/priority/3”,“iconUrl”:“https://xxx.atlassian.net/images/icons/priorities/medium.svg”,“name”:“Medium”,“id”:“3”},{“self”:“https://xxx.atlassian.net/rest/api/2/priority/4”,“iconUrl”:“https://xxx.atlassian.net/images/icons/priorities/low.svg”,“name”:“Low”,“id”:“4”},{“self”:“https://xxx.atlassian.net/rest/api/2/priority/5”,“iconUrl”:“https://xxx.atlassian.net/images/icons/priorities/minor.svg”,“name”:“Lowest”,“id”:“5”},{“self”:“https://xxx.atlassian.net/rest/api/2/priority/10000”,“iconUrl”:“https://xxx.atlassian.net/secure/thumbnail/23044/generic-Med-red-cross-small.jpg”,“name”:"For Triage”,“id”:“10000”}],“defaultValue”:{“self”:“https://xxx.atlassian.net/rest/api/2/priority/10000",“iconUrl”:“https://xxx.atlassian.net/secure/thumbnail/23044/generic-Med-red-cross-small.jpg”,“name”:"For Triage”,“id”:“10000”}},“customfield_10860”:{“required”:false,“schema”:{“type”:“string”,“custom”:“com.atlassian.jira.plugin.system.customfieldtypes:textfield”,“customId”:10860},“name”:“Shotgun Type”,“key”:“customfield_10860”,“hasDefaultValue”:false,“operations”:[“set”]},“customfield_10861”:{“required”:false,“schema”:{“type”:“string”,“custom”:“com.atlassian.jira.plugin.system.customfieldtypes:textfield”,“customId”:10861},“name”:“Shotgun ID”,“key”:“customfield_10861”,“hasDefaultValue”:false,“operations”:[“set”]},“labels”:{“required”:false,“schema”:{“type”:“array”,“items”:“string”,“system”:“labels”},“name”:“Labels”,“key”:“labels”,“autoCompleteUrl”:“https://xxx.atlassian.net/rest/api/1.0/labels/suggest?query=",“hasDefaultValue”:false,“operations”:[“add”,“set”,“remove”]},“customfield_10015”:{“required”:false,“schema”:{“type”:“any”,“custom”:“com.pyxis.greenhopper.jira:gh-epic-link”,“customId”:10015},“name”:"Epic Link”,“key”:“customfield_10015”,“hasDefaultValue”:false,“operations”:[“set”]},“customfield_10862”:{“required”:false,“schema”:{“type”:“string”,“custom”:“com.atlassian.jira.plugin.system.customfieldtypes:textfield”,“customId”:10862},“name”:“Shotgun URL”,“key”:“customfield_10862”,“hasDefaultValue”:false,“operations”:[“set”]},“customfield_10019”:{“required”:false,“schema”:{“type”:“array”,“items”:“json”,“custom”:“com.pyxis.greenhopper.jira:gh-sprint”,“customId”:10019},“name”:“Sprint”,“key”:“customfield_10019”,“hasDefaultValue”:false,“operations”:[“set”]},“attachment”:{“required”:false,“schema”:{“type”:“array”,“items”:“attachment”,“system”:“attachment”},“name”:“Attachment”,“key”:“attachment”,“hasDefaultValue”:false,“operations”:},“customfield_10856”:{“required”:false,“schema”:{“type”:“number”,“custom”:“com.atlassian.jira.plugin.system.customfieldtypes:float”,“customId”:10856},“name”:“Affected Build”,“key”:“customfield_10856”,“hasDefaultValue”:false,“operations”:[“set”]},“versions”:{“required”:false,“schema”:{“type”:“array”,“items”:“version”,“system”:“versions”},“name”:“Affects versions”,“key”:“versions”,“hasDefaultValue”:false,“operations”:[“set”,“add”,“remove”],“allowedValues”:},“customfield_10857”:{“required”:false,“schema”:{“type”:“number”,“custom”:“com.atlassian.jira.plugin.system.customfieldtypes:float”,“customId”:10857},“name”:“Fixed Build”,“key”:“customfield_10857”,“hasDefaultValue”:false,“operations”:[“set”]},“issuelinks”:{“required”:false,“schema”:{“type”:“array”,“items”:“issuelinks”,“system”:“issuelinks”},“name”:“Linked Issues”,“key”:“issuelinks”,“autoCompleteUrl”:"https://xxxx.atlassian.net/rest/api/2/issue/picker?currentProjectId=…

1 Like

It appears to be Jira user related, still unable to figure out what exactly caused the issue. I was able to bypass it by changing the integration user from a regular user to admin.

2 Likes

Bringing this issue back because I’m having the same problem and it doesn’t look like it was ever solved.

This code does not return the correct issue type for the given jira project:

 jira_issue_type = self.issue_type_by_name(issue_type)

I had to find the actual issue type ID for my specification and enter it into the settings explicitly, modifying the settings to be:

SYNC = {
    "default": {
        # The syncer class to use
        "syncer": "sg_jira.TaskIssueSyncer",
        # And its specific settings which are passed to its __init__ method
        "settings": {
            "issue_type": "10009"
        },
    },

and the code to be:

        if issue_type.isnumeric():
            jira_issue_type = self.issue_type(issue_type)
        else:
            jira_issue_type = self.issue_type_by_name(issue_type)

However, this isn’t great because it could be different per project. For example, the issue type for Task and Epic IDs returned by name do not match the Task and Epic issue type IDs for Task and Epic in my Jira project.

Anyone have any insight into a better fix?