JOJ0 / synadm

Command line admin tool for Synapse (the Matrix reference homeserver)
https://synadm.readthedocs.io
GNU General Public License v3.0
186 stars 25 forks source link

User modify JSONDecodeError #150

Closed rschrenk closed 3 months ago

rschrenk commented 3 months ago

I try to create a test user account using synadm --non-interactive user modify -n "Test" test, but unfortunately I receive

Current user account settings:
WARNING Synapse returned status code 400
{
    "errcode": "M_UNKNOWN",
    "error": "Can only look up local users"
}
User account settings to be modified:
display_name: Test
WARNING Synapse returned status code 405
ERROR JSONDecodeError while querying Synapse: Expecting value: line 1 column 1 (char 0)
User could not be modified/created.

The same error appears, when I use

synadm --non-interactive user modify -n "Test" '@test:matrix.___MYDOMAIN___'

Is this a bug in synadm or am I doing anything wrong? I checked the documentation multiple times, but I cannot find a mistake.

JacksonChen666 commented 3 months ago

Run synadm -vv --non-interactive user modify -n "Test" test or synadm -vv --non-interactive user modify -n "Test" '@test:matrix.___MYDOMAIN___' for more debug output.


Something I'd suggest trying is running synadm config to reconfigure a potentially misconfigured value. When you see the following:

Homeserver name ("auto-retrieval" or the domain part in your MXID):

Set it to the domain part of your MXID. For example: with the MXID @admin:localhost:8480, set the Homeserver name option to localhost:8480 (this is just an example and the actual value depends on your homeserver).

(If you don't see "("auto-retrieval" or the domain part in your MXID)" when synadm config asks for the "Homeserver name", your synadm is probably outdated, but that shouldn't interfere too much)

rschrenk commented 3 months ago

Thank your for the fast response. I switch to using the APIs through CURL requests directly...

JOJ0 commented 3 months ago

Thank your for the fast response. I switch to using the APIs through CURL requests directly...

If you ever come back to using the admin api via synadm again @rschrenk, as @JacksonChen666 suggested, starting a synadm command with global option -vv will always give you the actual api call in detail :-)

And also as @JacksonChen666 pointed out already I'd like to second that your error most probably points to a misconfiguration of the servername config option.

If you would really find a bug in what I call our "server name auto-retrieval magic" we definitely would love to know so we can fix it! ☝️

JOJ0 commented 3 months ago

Is matrix.something really your servers name, often people configure their Synapses to be just the domain name.

So for referencing a user, instead of

@test:matrix.___MYDOMAIN___

you would use

@test:___MYDOMAIN___