anonymousland-synapse/synapse/http
Eric Eastwood 1bf2832714
Indicate what endpoint came back with a JSON response we were unable to parse ()
**Before:**
```
WARNING - POST-11 - Unable to parse JSON: Expecting value: line 1 column 1 (char 0) (b'')
```

**After:**
```
WARNING - POST-11 - Unable to parse JSON from POST /_matrix/client/v3/join/%21ZlmJtelqFroDRJYZaq:hs1?server_name=hs1 response: Expecting value: line 1 column 1 (char 0) (b'')
```

---

It's possible to figure out which endpoint these warnings were coming from before but you had to follow the request ID `POST-11` to the log line that says `Completed request [...]`. Including this key information next to the JSON parsing error makes it much easier to reason whether it matters or not.

```
2022-09-29T08:23:25.7875506Z synapse_main | 2022-09-29 08:21:10,336 - synapse.http.matrixfederationclient - 299 - INFO - POST-11 - {GET-O-13} [hs1] Completed request: 200 OK in 0.53 secs, got 450 bytes - GET matrix://hs1/_matrix/federation/v1/make_join/%21ohtKoQiXlPePSycXwp%3Ahs1/%40charlie%3Ahs2?ver=1&ver=2&ver=3&ver=4&ver=5&ver=6&ver=org.matrix.msc2176&ver=7&ver=8&ver=9&ver=org.matrix.msc3787&ver=10&ver=org.matrix.msc2716v4
```


---

As a note, having no `body` is normal for the `/join` endpoint and it can handle it.

0c853e0970/synapse/rest/client/room.py (L398-L403)

Alternatively we could remove these extra logs but they are probably more usually helpful to figure out what went wrong.
2022-10-07 11:39:45 -05:00
..
federation Reduce the number of "untyped defs" () 2022-05-12 14:33:50 +00:00
__init__.py Add missing type hints to synapse.http. () 2021-12-14 07:00:47 -05:00
additional_resource.py Add missing type hints to synapse.http. () 2021-12-14 07:00:47 -05:00
client.py Reduce the number of "untyped defs" () 2022-05-12 14:33:50 +00:00
connectproxyclient.py Another batch of type annotations () 2022-05-13 12:35:31 +01:00
matrixfederationclient.py Validate federation destinations and log an error if server name is invalid. () 2022-07-20 11:17:26 -07:00
proxyagent.py Fix access token leak to logs from proxyagent () 2022-09-23 11:49:39 -05:00
request_metrics.py Reduce the number of "untyped defs" () 2022-05-12 14:33:50 +00:00
server.py Fix mypy errors with latest canonicaljson () 2022-09-26 13:30:00 +01:00
servlet.py Indicate what endpoint came back with a JSON response we were unable to parse () 2022-10-07 11:39:45 -05:00
site.py Be able to correlate timeouts in reverse-proxy layer in front of Synapse (pull request ID from header) () 2022-09-15 15:32:25 -05:00
types.py Unify HTTP query parameter type hints () 2022-04-08 13:06:51 +01:00