Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

/messages endpoint returns end token identical to from token #12102

Closed
johannescpk opened this issue Feb 28, 2022 · 2 comments · Fixed by #12903
Closed

/messages endpoint returns end token identical to from token #12102

johannescpk opened this issue Feb 28, 2022 · 2 comments · Fixed by #12903
Labels
A-Spec-Compliance places where synapse does not conform to the spec S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.

Comments

@johannescpk
Copy link

johannescpk commented Feb 28, 2022

Description

Goal is to fetch messages in a room backwards.

Steps to reproduce

  • My client first does a /sync to get the latest next_batch token
  • I'm then using that token to pass it into the messages endpoint as { from: $next_batch, direction: "b", .. }.
  • The response from the server has an end field that's the same as the next_batch token that was used in the initial request, additionally to all room messages.

So it seems there's an issue with synapse not leaving the end token empty if it reaches the end of the timeline.

For reference, here's the raw response from synapse, where start and end are identical.

matrix_sdk::http_client: Got response: Response { status: 200, version: HTTP/1.1, headers: {"transfer-encoding": "chunked", "server": "Synapse/1.53.0", "date": "Mon, 28 Feb 2022 14:45:37 GMT", "content-type": "application/json", "cache-control": "no-cache, no-store, must-revalidate", "access-control-allow-origin": "*", "access-control-allow-methods": "GET, HEAD, POST, PUT, DELETE, OPTIONS", "access-control-allow-headers": "X-Requested-With, Content-Type, Authorization, Date"}, body: b"{"chunk":[],"start":"t1-915_1917_28_2_75_1_1_77_1","end":"t1-915_1917_28_2_75_1_1_77_1"}" }

Version information

  • Homeserver: Local dev instance

If not matrix.org:

  • Version: 1.53.0

  • Install method: docker hub

  • Platform: x86 64bit, docker container
@richvdh
Copy link
Member

richvdh commented Feb 28, 2022

I find it amazing that we don't have an issue for this already, but I don't think we do.

It was discussed at matrix-org/matrix-spec-proposals#2251 (comment), but there doesn't appear to have been an issue filed.

@richvdh richvdh added A-Spec-Compliance places where synapse does not conform to the spec S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. labels Feb 28, 2022
@richvdh
Copy link
Member

richvdh commented Feb 28, 2022

I'd be happy to see a PR that fixes this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Spec-Compliance places where synapse does not conform to the spec S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants