Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Element tries to use the deprecated media endpoints on a server enacting the freeze #28011

Closed
HarHarLinks opened this issue Sep 4, 2024 · 11 comments
Labels
A-Media O-Uncommon Most users are unlikely to come across this or unexpected workflow S-Major Severely degrades major functionality or product features, with no satisfactory workaround T-Defect

Comments

@HarHarLinks
Copy link
Contributor

HarHarLinks commented Sep 4, 2024

Steps to reproduce

i tried out setting enable_authenticated_media: true in a localhost synapse yesterday and logged in with app.element.io. element could not receive any media and watching the browser devtools network log i could see the requests using the old endpoints (and 404ing as i'd expect per synapse docs). checking synapse's versions there is v1.11 support and using curl i could also GET the media from the new endpoints. does someone know what's wrong? i have peers telling me it's working for them on their prod deployments that already enacted the "freeze".

Outcome

What did you expect?

authenticated media

What happened instead?

unauthenticated media 404ing, no media

Operating system

arch

Browser information

Firefox 128

URL for webapp

app.element.io

Application version

Element version: 1.11.76 Crypto version: Rust SDK 0.7.1 (c8c9d15), Vodozemac 0.6.0

Homeserver

matrixdotorg/synapse:latest

Will you send logs?

Yes

@dosubot dosubot bot added A-Media O-Uncommon Most users are unlikely to come across this or unexpected workflow labels Sep 4, 2024
@mkoppmann
Copy link

I have the same issue. It does work with Element Desktop and the mobile apps, but my self-hosted Element Web instance fails due to the usage of the old API:

Error downloading image

It uses: https://matrix.example.org/_matrix/media/v3/download/example.org/MHM%E2%80%A6XZurja?allow_redirect=true while Element Desktop is using: blob:vector://vector/df31…918e4 and https://matrix.example.org/_matrix/client/v1/media/thumbnail/example.org/ODgJqxkZ…Bgm?width=28&height=28&method=crop&allow_redirect=true for things like profile images.

@florianduros florianduros added the S-Major Severely degrades major functionality or product features, with no satisfactory workaround label Sep 5, 2024
@richvdh
Copy link
Member

richvdh commented Sep 5, 2024

and watching the browser devtools network log i could see the requests using the old endpoint

One thing to note is that the browser devtools cannot be trusted here: there is a serviceworker which is supposed to rewrite the request, but that happens after the devtools that record the request.

I'd suggest checking the server-side logs to verify which endpoint is actually being used

@mkoppmann
Copy link

From my Synapse logs:

synapse.http.server: [GET-382] <XForwardedForRequest at 0x7f6704810910 method='GET' uri='/_matrix/media/v3/download/example.org/yxwwqx…NkQ?allow_redirect=true' clientproto='HTTP/1.1' site='8008'> SynapseError: 404 - Not found

@dbkr
Copy link
Member

dbkr commented Sep 5, 2024

This might be that the service worker hasn't registered, which can happen sometimes especially as we previously did have a service worker that didn't do anything and wasn't really registered properly. A hard reload or three would be worth a try.

@mkoppmann
Copy link

I tried it in browsers where Element Web was never loaded before and also unregistered the service worker in my regular browser. The problem still occured.

Then I tried https://app.element.io and the pictures loaded on that instance. I compared https://app.element.io/sw.js with the service worker on my instance and the source code on my server was several times larger. I was running v1.11.75 from NixOS 24.05.

Then I realized that v1.11.76 was pushed to stable. I upgraded my instance, now the authenticated images are loading and the sw.js file is identical to the one on app.element.io again.

@HarHarLinks
Copy link
Contributor Author

🤷 started working sometime between then and now

@chmeeedalf
Copy link

I see this problem on Safari, but it works fine from Brave, both on the same macOS device, with the latest element-web (logging into app.element.io). I checked the sw.js downloaded from both browsers, and diff shows them identical.

@turt2live
Copy link
Member

The downloaded sw.js may be different than the one the browser is using. Excessive page reloads generally fixes it.

@czeidler
Copy link

czeidler commented Sep 7, 2024

Not sure if its the same issue but since about two days I can't open new images (old image are loading fine). I am getting "Error downloading image". All involved parties are at matrix.org. We are seeing it on Android + desktop. Clients haven't been updated recently.

@t3chguy
Copy link
Member

t3chguy commented Sep 12, 2024

Clients haven't been updated recently.

That'll be why then, authenticated media is relatively new, so you need to be up to date if you are using a server which requires this.

@HarHarLinks has stated it has started working for them so closing this issue. It seems to be one of using outdated clients or having a stuck serviceworker registration cached in their browser.

@t3chguy t3chguy closed this as completed Sep 12, 2024
@jxu
Copy link

jxu commented Sep 12, 2024

I had the same issue. I just reinstalled element-desktop from Ubuntu apt repos and I had to pkill to get it to update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Media O-Uncommon Most users are unlikely to come across this or unexpected workflow S-Major Severely degrades major functionality or product features, with no satisfactory workaround T-Defect
Projects
None yet
Development

No branches or pull requests

11 participants