JIRA categories can not be retrieved using oauth token
Description
Problem/Justification
None
Impact
None
blocks
Activity
Show:
Denys Butenko October 19, 2021 at 2:54 PM
@Vladimir Vinogradenko it worked, thanks for the tip
Vladimir Vinogradenko October 19, 2021 at 2:46 PM
@Denys Butenko window.open returns you a JSON string. This entire string is a token, you should not decode it.
Denys Butenko October 19, 2021 at 2:40 PM
@Vladimir Vinogradenko yeah, you are right that didn't help. I've patched local middleware with the fix and now getting 500 error.
aEiIkqJCcsigs6dOV3s8Z0eHDxARs5QQ is oauth_token property from response
For this query (token as string):
{
"id": "3bf92d0d-bca9-dc27-1b93-95102580f5c2",
"msg": "method",
"method": "support.fetch_categories",
"params": [
"aEiIkqJCcsigs6dOV3s8Z0eHDxARs5QQ"
]
}
Getting error:
{
"error": 74,
"type": null,
"reason": "[EBADMSG] Invalid proxy server response: 500, message='INTERNAL SERVER ERROR', url=URL('https://support-proxy.ixsystems.com/freenas/api/v1.0/categories')",
"trace": {
"class": "CallError",
"frames": [
{
"filename": "/usr/lib/python3/dist-packages/middlewared/main.py",
"lineno": 179,
"method": "call_method",
"line": " self.send_error(message, e.errno, str(e), sys.exc_info(), extra=e.extra)\n",
"argspec": [
"self",
"message",
"serviceobj",
"methodobj"
],
"locals": {
"self": "<middlewared.main.Application object at 0x7f4a28248f40>",
"message": "{'id': '3bf92d0d-bca9-dc27-1b93-95102580f5c2', 'msg': 'method', 'method': 'support.fetch_categories', 'params': ['aEiIkqJCcsigs6dOV3s8Z0eHDxARs5QQ']}",
"serviceobj": "<middlewared.plugins.support.SupportService object at 0x7f4a2be71ee0>",
"methodobj": "<bound method accepts.<locals>.wrap.<locals>.nf of <middlewared.plugins.support.SupportService object at 0x7f4a2be71ee0>>",
"params": "['aEiIkqJCcsigs6dOV3s8Z0eHDxARs5QQ']",
"e": "CallError(\"Invalid proxy server response: 500, message='INTERNAL SERVER ERROR', url=URL('https://support-proxy.ixsystems.com/freenas/api/v1.0/categories')\", 74)"
}
},
{
"filename": "/usr/lib/python3/dist-packages/middlewared/main.py",
"lineno": 1267,
"method": "_call",
"line": " return await methodobj(*prepared_call.args)\n",
"argspec": [
"self",
"name",
"serviceobj",
"methodobj",
"params"
],
"keywordspec": "kwargs",
"locals": {
"self": "<middlewared.main.Middleware object at 0x7f4a33e5e9d0>",
"name": "'support.fetch_categories'",
"serviceobj": "<middlewared.plugins.support.SupportService object at 0x7f4a2be71ee0>",
"methodobj": "<bound method accepts.<locals>.wrap.<locals>.nf of <middlewared.plugins.support.SupportService object at 0x7f4a2be71ee0>>",
"params": "['aEiIkqJCcsigs6dOV3s8Z0eHDxARs5QQ']",
"kwargs": "{'app': <middlewared.main.Application object at 0x7f4a28248f40>, 'io_thread': False}",
"prepared_call": "<middlewared.main.PreparedCall object at 0x7f4a283f0eb0>"
}
},
{
"filename": "/usr/lib/python3/dist-packages/middlewared/schema.py",
"lineno": 1263,
"method": "nf",
"line": " return await func(*args, **kwargs)\n",
"varargspec": "args",
"keywordspec": "kwargs",
"locals": {
"args": "('***', '***')",
"kwargs": "{}",
"clean_and_validate_args": "<function accepts.<locals>.wrap.<locals>.clean_and_validate_args at 0x7f4a33127790>",
"func": "<function returns.<locals>.returns_internal.<locals>.nf at 0x7f4a331278b0>"
}
},
{
"filename": "/usr/lib/python3/dist-packages/middlewared/schema.py",
"lineno": 1131,
"method": "nf",
"line": " res = await f(*args, **kwargs)\n",
"varargspec": "args",
"keywordspec": "kwargs",
"locals": {
"args": "('***', '***')",
"kwargs": "{}",
"f": "<function SupportService.fetch_categories at 0x7f4a33127820>",
"nf": "<function returns.<locals>.returns_internal.<locals>.nf at 0x7f4a331278b0>"
}
},
{
"filename": "/usr/lib/python3/dist-packages/middlewared/plugins/support.py",
"lineno": 155,
"method": "fetch_categories",
"line": " data = await post(\n",
"argspec": [
"self",
"token"
],
"locals": {
"self": "<middlewared.plugins.support.SupportService object at 0x7f4a2be71ee0>",
"token": "'aEiIkqJCcsigs6dOV3s8Z0eHDxARs5QQ'",
"sw_name": "'freenas'"
}
},
{
"filename": "/usr/lib/python3/dist-packages/middlewared/plugins/support.py",
"lineno": 32,
"method": "post",
"line": " raise CallError(f'Invalid proxy server response: {e}', errno.EBADMSG)\n",
"argspec": [
"url",
"data",
"timeout"
],
"locals": {
"url": "'https://support-proxy.ixsystems.com/freenas/api/v1.0/categories'",
"data": "'{\"token\": \"aEiIkqJCcsigs6dOV3s8Z0eHDxARs5QQ\"}'",
"timeout": "15",
"session": "<aiohttp.client.ClientSession object at 0x7f4a28332130>"
}
}
],
"formatted": "Traceback (most recent call last):\n File \"/usr/lib/python3/dist-packages/middlewared/plugins/support.py\", line 28, in post\n req = await session.post(url, headers={\"Content-Type\": \"application/json\"}, data=data)\n File \"/usr/lib/python3/dist-packages/aiohttp/client.py\", line 625, in _request\n resp.raise_for_status()\n File \"/usr/lib/python3/dist-packages/aiohttp/client_reqrep.py\", line 1000, in raise_for_status\n raise ClientResponseError(\naiohttp.client_exceptions.ClientResponseError: 500, message='INTERNAL SERVER ERROR', url=URL('https://support-proxy.ixsystems.com/freenas/api/v1.0/categories')\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"/usr/lib/python3/dist-packages/middlewared/main.py\", line 151, in call_method\n result = await self.middleware._call(message['method'], serviceobj, methodobj, params, app=self,\n File \"/usr/lib/python3/dist-packages/middlewared/main.py\", line 1267, in _call\n return await methodobj(*prepared_call.args)\n File \"/usr/lib/python3/dist-packages/middlewared/schema.py\", line 1263, in nf\n return await func(*args, **kwargs)\n File \"/usr/lib/python3/dist-packages/middlewared/schema.py\", line 1131, in nf\n res = await f(*args, **kwargs)\n File \"/usr/lib/python3/dist-packages/middlewared/plugins/support.py\", line 155, in fetch_categories\n data = await post(\n File \"/usr/lib/python3/dist-packages/middlewared/plugins/support.py\", line 32, in post\n raise CallError(f'Invalid proxy server response: {e}', errno.EBADMSG)\nmiddlewared.service_exception.CallError: [EBADMSG] Invalid proxy server response: 500, message='INTERNAL SERVER ERROR', url=URL('https://support-proxy.ixsystems.com/freenas/api/v1.0/categories')\n",
"repr": "CallError(\"Invalid proxy server response: 500, message='INTERNAL SERVER ERROR', url=URL('https://support-proxy.ixsystems.com/freenas/api/v1.0/categories')\", 74)"
},
"extra": null
}
Using Shell directly (the same issue):
Preview unavailable
Do you have ideas what's wrong?
Vladimir Vinogradenko October 19, 2021 at 2:02 PM
@Denys Butenko I fixed middleware handling non-200 responses from server; however, this fix won't help you, the support server is returning non-200 response, most likely due to token not being a valid JSON string.
Complete
Details
Assignee
Vladimir VinogradenkoVladimir VinogradenkoReporter
Denys ButenkoDenys ButenkoTime remaining
0mComponents
Fix versions
Affects versions
Priority
Low
Details
Details
Assignee
Vladimir Vinogradenko
Vladimir VinogradenkoReporter
Denys Butenko
Denys ButenkoTime remaining
0m
Components
Fix versions
Affects versions
Priority
Katalon Platform
Linked Test Cases, Katalon Defect Results, Katalon Studio Test Results
Katalon Platform
Linked Test Cases, Katalon Defect Results, Katalon Studio Test Results
Katalon Platform
Linked Test Cases, Katalon Defect Results, Katalon Studio Test Results
Created October 19, 2021 at 8:24 AM
Updated July 6, 2022 at 9:02 PM
Resolved November 15, 2021 at 9:17 PM
While working on the integration of OAuth token on JIRA form in webui ( https://jira.ixsystems.com/browse/NAS-112132 ) I'm getting an error when making request to get categories ( support.fetch_categories endpoint).
Ping me if you have any questions. Thanks