Unexpected token u in JSON at position 0

Hi All,



I have a server action which gets binary data in response from server.

I get the following error, and it is very rare, not able to simulate always.

Can anyone tell me what exactly it is, i have mentioned the log below :-


Id
4ba6d5cc-596a-4cb8-b389-7c85912
Time of Log
2020-08-11 16:53:46
Request Key
dbca77-e727-42bf-a514-e6317f2a6e
Module
Connect_App
Tenant
User
Session Id
uKciiXsRXUSULYrbCdg==
Server
outsys-dev-vm

Source
Message
Unexpected token u in JSON at position 0
Environment Information
eSpaceVer: Id=15105, PubId=0, CompiledWith=11.7.3.7036
RequestUrl: http://app-dev.com/Connect/moduleservices/log?clientTimeInMillis=1597164827394 (Method: POST)

AppDomain: /LM/W3SVC/1/ROOT/Connect_App-60-13241612329383269
FilePath: E:\OutSystems\Platform Server\running\Connect_App.059706539\
ClientIp: 10.248.141.6 X-Forwarded-For: 157.33.238.49:41872
DeviceUUID: 7c3074bd1251449c
Locale: en-US
DateFormat: yyyy-MM-dd
PID: 5336 ('w3wp', Started='8/11/2020 1:32:09 AM', Priv=1230Mb, Virt=2115918Mb)
TID: 208
Thread Name:
.NET: 4.0.30319.42000
DeviceModel: SM-G615FU
DeviceUUID: 7c3074bd1251449c
OperatingSystem: Android 8.1.0
NativeShell: 8.3.2
AppVersionCode: 190
AppVersionName: 0.26
NetworkStatus: Online
NetworkType: LTE
Cordova: 8.1.0
Client-Side Log
Stack
DownloadImage
SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at l.onSuccess (https://app-dev.com/Connect/scripts/OutSystems.js?PGHrEBzLHyLxW9cX_pLDCA:3:27625)
at HttpRequest.onSuccess (https://app-dev.com/Connect/scripts/OutSystems.js?PGHrEBzLHyLxW9cX_pLDCA:2:29201)
at https://app-dev.com/Connect/scripts/plugins/com.outsystems.plugins.http/www/request-manager.js:240:22
at Array.forEach (<anonymous>)
at RequestManager.invokeCallbacks (https://app-dev.com/Connect/scripts/plugins/com.outsystems.plugins.http/www/request-manager.js:230:23)
at RequestManager._handleSuccess (https://app-dev.com/Connect/scripts/plugins/com.outsystems.plugins.http/www/request-manager.js:164:22)
at RequestManager._handleSend (https://app-dev.com/Connect/scripts/plugins/com.outsystems.plugins.http/www/request-manager.js:79:14)
at Object.callbackFromNative (https://app-dev.com/Connect/scripts/cordova.js?7KqI9_oL9hClomz1RdzTqg:287:58)
at processMessage (https://app-dev.com/Connect/scripts/cordova.js?7KqI9_oL9hClomz1RdzTqg:1129:17)



Anyone on this?


Regards,

Dhiraj M.

Hi Dhiraj,

It seems like the response you are receiving in JSON is not always coming according to the structure you have created to parse it and the reason you getting the error. Maybe, you can put a log and print the JSON response, to check if it is coming as you expected. 

Also, have a look at the below forum, It might help you. 

https://stackoverflow.com/questions/42145287/uncaught-syntaxerror-unexpected-token-u-in-json-at-position-0-at-json-parse-a 

Sachin

Sachin Mahawar wrote:

Hi Dhiraj,

It seems like the response you are receiving in JSON is not always coming according to the structure you have created to parse it and the reason you getting the error. Maybe, you can put a log and print the JSON response, to check if it is coming as you expected. 

Also, have a look at the below forum, It might help you. 

https://stackoverflow.com/questions/42145287/uncaught-syntaxerror-unexpected-token-u-in-json-at-position-0-at-json-parse-a 

Sachin

 Hi Sachin,

Thanks for replying.

My response is binary always.

Also it is very rare, i am not able to reproduce this always,

so where should i place the log i am not sure.


Thanks,

Dhiraj.

 

Hi Dhiraj,


Can you give a little more information.are you trying to any html code in outsystems expression?

Please check below comment:

JSON should start with a valid JOSN value – an object, array, string, number, or false/true/null This response started with a <(hence the “Unexpected  token<").

That unexpected token, < is a strong clue that the response was HTML instead of JSON.