deepstreamIO / deepstream.io

deepstream.io server

Home Page:https://deepstreamio.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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)

Снимок экрана 2021-12-21 в 17 13 22

Error in line 22

Снимок экрана 2021-12-21 в 17 26 20

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

Снимок экрана 2021-12-21 в 17 49 20

Снимок экрана 2021-12-21 в 17 49 43

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