Bad JSON is returned
caracal7 opened this issue · comments
Bad JSON is arrived to client after another client call client.record.setData('my_record', my_json);
I get this issue only with one specific query from DB. Result after this query is 100% valid JSON (about 3K lines).
After I call client.record.setData('my_record', my_json);
on node.js client I get this error in browser(Safari or Chrome)
Error in line 22
if I console.log(message.data)
before line 22 I get string with four U+FFFD characters in a random places. Thats why JSON.parse() gets the error
Looks like a bug with message encoding/decoding
I don't know how to isolate and reproduce this issue right now.
Sorry for my terrible english
Hi, I'm going to close this here because it should be opened in the deepstream-client-js repo. please reopen there if problem persists
And I don think it is deepstream related, all encoding/decoding is done using protobufjs...please double check that your original data is not corrupt, adn take a look at https://github.com/protobufjs/protobuf.js/issues if there is something there.
And I don think it is deepstream related, all encoding/decoding is done using protobufjs...please double check that your original data is not corrupt, adn take a look at https://github.com/protobufjs/protobuf.js/issues if there is something there.
You are right.
This is a problem with protobufjs.
Protobufjs is not well maintained anymore. 400+ opened issues. Seems like to solve any problems with Protobufjs is too difficult. I changed connectionEndpoints to ws-json and it is solve my problem and data is not corrupted.
Is it not a problem to use ws-json in production?
It is not optimal to use the json endpoint in production in terms of ressource efficiency, but it can be done