matrix-org / synapse

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

`/_matrix/client/r0/rooms/{roomId}/event/{eventId}` return Http 404 for invitation Event #15246

Open bmarty opened 1 year ago

bmarty commented 1 year ago

Description

When a user is invited to a room, a Push is received with the eventId and the roomId of the invitation (it's a m.room.member event)

If the application tries to request the event content before the user has joined the room using /_matrix/client/r0/rooms/{roomId}/event/${eventId} (RoomEventServlet), the server answers with a HTTP 404.

Once the user joins the room, the server returns the event content for the same request.

I would expect the server to return the Event content, since the user is allowed to see it (it's coming from the sync response).

Steps to reproduce

See description.

Homeserver

Synapse

Synapse Version

1.79.0rc1 (b=matrix-org-hotfixes,a95e906227)

Installation Method

I don't know

Database

matrix.org

Workers

I don't know

Platform

matrix.org

Configuration

No response

Relevant log output

N/A

Anything else that would be useful to know?

This issue is not critical, and no bad side effect has been detected on Element Android due to this.

jmartinesp commented 1 year ago

For Element X this is a more severe issue: without this info we can't get the data we need to display invite notifications (https://github.com/vector-im/element-meta/issues/1094, https://github.com/matrix-org/matrix-rust-sdk/issues/2179).

MadLittleMods commented 1 year ago

Discussed earlier with @jmartinesp in an internal room,

For reference, the invite event is returned as expected for "out-of-band" membership events, i.e. if the event is an outlier (think federation and no one from your server is in the room already).

But otherwise, Synapse will 404 if the event isn't an outlier which seems like a bug since we consider it being fine for outliers (no reason to have this caveat).

Really easy to reproduce locally between two users:

  1. Create a room
  2. Invite the other user
  3. From the other user, GET /_matrix/client/v3/rooms/{room_id}/event/{event_id} -> 404 M_NOT_FOUND Event not found.