matrix-org / synapse

Synapse: Matrix homeserver written in Python/Twisted.
https://matrix-org.github.io/synapse
Apache License 2.0
11.82k stars 2.13k forks source link

Error when sending GET request to _synapse/admin/v1/rooms with curl #8301

Closed dngray closed 4 years ago

dngray commented 4 years ago

Description

When sending a GET /_synapse/admin/v1/rooms using the admin_api with curl I hit an internal error.

Ie:

curl -v -H "Authorization: Bearer $accessToken" \
    -X GET 'https://chat.example.com:8448/_synapse/admin/v1/rooms'
{
    "errcode": "M_UNKNOWN",
    "error": "Internal server error"
}

The synapse logs produce this exception:

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/venvs/matrix-synapse/lib/python3.6/site-packages/synapse/http/server.py", line 233, in _async_render_wrapper
    self._send_response(request, code, response)
  File "/opt/venvs/matrix-synapse/lib/python3.6/site-packages/synapse/http/server.py", line 295, in _send_response
    canonical_json=self.canonical_json,
  File "/opt/venvs/matrix-synapse/lib/python3.6/site-packages/synapse/http/server.py", line 536, in respond_with_json
    json_bytes = encode_pretty_printed_json(json_object) + b"\n"
  File "/opt/venvs/matrix-synapse/lib/python3.6/site-packages/canonicaljson.py", line 96, in encode_pretty_printed_json
    return _pretty_encoder.encode(json_object).encode("ascii")
UnicodeEncodeError: 'ascii' codec can't encode character '\u2122' in position 44668: ordinal not in range(128)
2020-09-11 18:01:21,239 - synapse.access.http.8008 - 311 - INFO - GET-32809 - <IP>- 8008 - {@user:example.com} Processed request: 0.041sec/0.000sec (0.004sec, 0.000sec) (0.000sec/0.034sec/2) 69B 500 "GET /_synapse/admin/v1/rooms HTTP/1.0" "curl/7.64.1" [0 dbevts]

I do have longer logs, but they may contain private information. I am available on Matrix dngray:privacytools.io

Steps to reproduce

When we used Postman we don't get the error.

Version information

auscompgeek commented 4 years ago

Duplicate of #8188