Failure on OMM stream: Malformed JSON received during token refresh: '{"error":"server_error" ,"err
Hi Community members.
I really appreciate your support, sorry if this question is to direct, I wish to clarify I don't actually know if it is a bug on Refinitiv Server Backend side, just searching for solution.
Seems like there is an error on Refinitiv server related to the session refresh token process of OMM websocket stream:
I get an error message:
Malformed JSON received during token refresh: '{"error":"server_error" ,"error_description":"Request "xxxxxx-yyyyy-zzzz-tttt-sssssssss" has failed on backend call timeout" } '. Status code: 500
from first look the error might be a good explanation for the bug on the server
:"Request "xxxxxx-yyyyy-zzzz-tttt-sssssssss" has failed on backend call timeout"
the request uuid must be with ' \" ' literal double quotes or without them. - definitly not with plain text ' " ' .
by default, json parser may not parse a value with interleaving double Quates marks.
can you confirm?
If not - please inform me how to fix
Thanks
Ori Kovacsi Katz
EDITED:
using version:
./lib/python3.9/site-packages/refinitiv_data-1.0.0b20.dist-info
used search :
grep -rnw `pwd` -e "Malformed JSON received during token refresh"
on:
~/miniconda3/envs/<environment name>/lib/python3.9/site-packages/refinitiv/data/_core/session/refresh_token_updater.py line 63
I can see location of the failure the "def _on_update(self):" function
try:
json_content = response.json()
except json.decoder.JSONDecodeError:
message = (
f"Malformed JSON received during token refresh: '{response.text}'. "
f"Status code: {response.status_code}")
self.error(message)
self._callback(UpdateEvent.REFRESH_TOKEN_FAILED, message, {})
return
hope this will help to reproduce / resolve the issue
Answers
-
I can confirm this was the cause for Refinitiv OMM web-socket disconnection with
undocumented flow to an error call-back.
as a temporary workaround I tweaked the Refinitiv-Data 1.0.0b20 python package (python client connector) added broth force json parsing
workarround
try:
json_content=None
if response and response.text and "\"error\":\"server_error\"" in response.text:
print("[REFINITIV HACK ORI] fixing Malformed JSON", end=" ")
json_content=json.loads((''.join(response.text.split('\"'))).replace(":","\":\"").replace(" ,","\" ,\"").replace("{","{\"").replace("}","\"}"))
print(json_content)
else:
json_content = response.json()
except json.decoder.JSONDecodeError:
message = (
f"Malformed JSON received during token refresh: '{response.text}'. "
f"Status code: {response.status_code}")
self.error(message)
self._callback(UpdateEvent.REFRESH_TOKEN_FAILED, message, {})
returnI am not sure it will stand other error messages scenarios, but for now it solved my case, I suspect a bug on Refinitiv server side with multiple literal ' " ' double quate marks on same Json field without escape notation ' \" '
0 -
The latest RD Library version 1.0 is just released this week. The application should upgrade to this version.
0
Categories
- All Categories
- 6 AHS
- 37 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛