Owntracks HTTP status 200, JsonParseException

tscherinho2 years ago

Hi all,

I'm running a small instance of traccar for an NGO and recently I'm facing some problems using the owntracks protocol. Unfortunately, I can't tell for sure if this occurred after updating to version 5.5. It worked some days before update and does not work anymore. Anyway, downgrading again did not help.

When using owntracks the server log catches the message and when I decode the HEX it looks pretty fine to me. The server even indicates that the respective device is online, but position is not updated. And the OwnTracks app shows the following error: "HTTP status 200, JsonParseException".

Here is an example from my log

2023-01-28 09:06:12  INFO: [T3beb6c24] connected
2023-01-28 09:06:12  INFO: [T3beb6c24: owntracks < 172.24.0.3] 504f5354202f20485454502f312e300d0a486f73743a20747261636361723a353134340d0a436f6e6e656374696f6e3a20636c6f73650d0a436f6e74656e742d4c656e6774683a203232310d0a557365722d4167656e743a204f776e747261636b732d416e64726f69642f32303431303035310d0a582d4c696d69742d553a20757365720d0a582d4c696d69742d443a20646576696439353134370d0a43616368652d436f6e74726f6c3a206e6f2d63616368650d0a436f6e74656e742d547970653a206170706c69636174696f6e2f6a736f6e3b20636861727365743d7574662d380d0a4163636570742d456e636f64696e673a20677a69700d0a0d0a7b225f74797065223a226c6f636174696f6e222c22616363223a323030302c22616c74223a3438342c2262617474223a38362c226273223a312c22636f6e6e223a226d222c22637265617465645f6174223a313637343839363737332c226c6174223a34392e373331323139312c226c6f6e223a372e333132363937352c226d223a312c2274223a2270222c22746964223a223437222c22746f706963223a226f776e747261636b732f757365722f64657669643935313437222c22747374223a313637343839353838392c22766163223a31352c2276656c223a307d
2023-01-28 09:06:12  INFO: [T3beb6c24: owntracks > 172.24.0.3] 485454502f312e3120323030204f4b0d0a636f6e74656e742d6c656e6774683a20300d0a0d0a
2023-01-28 09:06:12  INFO: [T3beb6c24] disconnected

I've been working on finding the error for some time now but can't find a solution. Any help would be highly appreciated.

I’m running traccar within the ubuntu docker container (traccar/traccar:ubuntu) from docker hub.

Regards,

Anton Tananaev2 years ago

We don't send any JSON in response. Do you have a link to the protocol/API documentation

tscherinho2 years ago

Thanks for your fast response.

I'm using the original OwnTracks app on Android. Sorry for not mentioning this in the first place. What I have is the documentation from the internet: https://owntracks.org/booklet/tech/json/ . Not sure if that is what you need.

It is set to use http on port 5144.

Anton Tananaev2 years ago

Unfortunately I don't see anything about response there.

tscherinho2 years ago

I found this: https://owntracks.org/booklet/tech/http/. Looks like any HTTP code like 2xx is considered successful transmission. And JsonParseException makes sense, since traccar does not return any data in json format. But why is the position not updated?

tscherinho2 years ago

I have compared the incoming data from when everything worked and now and the converted strings look pretty much similar. Looking at the whole data from "connected" to "disconneccted" I noticed, that there is an INFO right after data is incomming and response is sent, that holds the device id, time, lat, lon, ... .

I don't get that line any more. To me this looks like there might be an issue with parsing the incoming data. Just a wild guess...

2022-12-01 07:37:03  INFO: [T585f2d3c] connected
2022-12-01 07:37:03  INFO: [T585f2d3c: owntracks < 172.20.0.3] 504f5354202f20485454502f312e300d0a486f73743a20747261636361723a353134340d0a436f6e6e656374696f6e3a20636c6f73650d0a436f6e74656e742d4c656e6774683a203231320d0a557365722d4167656e743a204f776e747261636b732d416e64726f69642f32303431303035310d0a582d4c696d69742d443a20646576696439353134370d0a43616368652d436f6e74726f6c3a206e6f2d63616368650d0a436f6e74656e742d547970653a206170706c69636174696f6e2f6a736f6e3b20636861727365743d7574662d380d0a4163636570742d456e636f64696e673a20677a69700d0a0d0a7b225f74797065223a226c6f636174696f6e222c22616363223a313239392c22616c74223a3335372c2262617474223a39382c226273223a322c22636f6e6e223a226d222c22637265617465645f6174223a313636393838303232312c226c6174223a34392e323534333337342c226c6f6e223a372e353931373036332c226d223a312c22746964223a223437222c22746f706963223a226f776e747261636b732f757365722f64657669643935313437222c22747374223a313636393838303130382c22766163223a322c2276656c223a307d
2022-12-01 07:37:03  INFO: [T585f2d3c: owntracks > 172.20.0.3] 485454502f312e3120323030204f4b0d0a636f6e74656e742d6c656e6774683a20300d0a0d0a
2022-12-01 07:37:03  INFO: [T585f2d3c] id: owntracks/user/devid95147, time: 2022-12-01 07:35:08, lat: 49.25434, lon: 7.59171, course: 0.0, accuracy: 1299.0
2022-12-01 07:37:03  INFO: [T585f2d3c] disconnected
Anton Tananaev2 years ago

Exception should not happen. Seems like the app is expecting some JSON response.

The issue with no data is that the device disconnects too quickly.