Closed ZhenyaPav closed 7 months ago
What's the full synadm
command that you ran?
What's the full
synadm
command that you ran?
synadm media delete -d 3
Can you show us a
synadm -vv media delete -d 3
maybe remove secrets before posting
synadm -vv media delete -d 3
DEBUG Config entry read. user: (username)
DEBUG Config entry read. token: REDACTED
DEBUG Config entry read. base_url: http://192.168.(local ip):8008
DEBUG Config entry read. admin_path: /_synapse/admin
DEBUG Config entry read. matrix_path: /_matrix
DEBUG Config entry read. timeout: 30
DEBUG Config entry read. server_discovery: well-known
DEBUG Config entry read. homeserver: matrix.(domain name)
DEBUG Config entry read. ssl_verify: True
DEBUG Config entry read. format: human
DEBUG Formatter in use: human - <function humanize at 0x7fad27985b20>
DEBUG Received --before-days: 3
INFO Deleting local media older than timestamp: 1709750339095,
INFO which is the date: 2024-03-06 20:38:59.095000
INFO Querying post on http://192.168.(local ip):8008/_synapse/admin/v1/media/matrix.(domain name)/delete
WARNING Synapse returned status code 400
errcode M_UNKNOWN
error Can only delete local media
I think it might be caused by the fact that the server is running on a local machine, with a VPS being used as a proxy. I left the Admin API accessible only through local network intentionally.
Possible workaround: Run synadm config
, and when you see this:
Homeserver name (auto-retrieval or matrix.DOMAIN):
Enter just the domain name without the matrix.
part. Then use synadm media purge
if you want to delete old remote media, or use synadm media delete
for deleting local media.
(I'll write a full explanation of the issue later. It seems to be with synadm config
being confusing for the user, and apparently a deprecation we seemed missed on the synapse admin local media delete API)
I happened to have the exact same issue. I think I know what's happening, so here's the explanation of the issue:
synadm config
asks you for the homeserver name like this:
Homeserver name (auto-retrieval or matrix.DOMAIN):
The user (probably, and in this case) follows the suggestion of matrix.DOMAIN
and inputs, for example, matrix.example.com
. That configuration value is passed into the API for deleting local media[^naming], as seen before:
INFO Querying post on http://192.168.(local ip):8008/_synapse/admin/v1/media/matrix.(domain name)/delete
However, with delegation, Synapse only treats example.com
as itself, even if hosted on matrix.example.com
.
So the "homeserver name" should've been inputted as example.com
, not matrix.example.com
. If auto-retrieval
was used instead, that would mean the homeserver name is set to example.com
, not matrix.example.com
.
Basically, synadm config
tells you to write the wrong thing.
We can do any of these to fix the issue:
synadm config
to tell the user what to input, correctly (and make sure the homeserver name is used consistently across the entire synadm
codebase).[^naming]: The synadm
command for deleting local media is somewhat confusingly named as synadm media delete
(used in this issue), while for remote media it's named synadm media purge
. The help text in synadm media delete
does not make the distinction clear between deleting local media and remote cached media.
Possible workaround: Run
synadm config
, and when you see this:Homeserver name (auto-retrieval or matrix.DOMAIN):
Enter just the domain name without the
matrix.
part. Then usesynadm media purge
if you want to delete old remote media, or usesynadm media delete
for deleting local media.(I'll write a full explanation of the issue later. It seems to be with
synadm config
being confusing for the user, and apparently a deprecation we seemed missed on the synapse admin local media delete API)
This seems to fix the issue
Keeping this issue open because the problem (a confusing synadm config
) is still there.
I'm unable to use
synadm media delete
, as it returns this, without deleting anything:The synapse server was installed using matrix-docker-ansible-deploy.