Skip to content

🐛 Bug Report: Presences survive blocking or deleting the user #14344

Closed

Description

@JoshiJoshiJoshi

👟 Reproduction steps

  1. Self-hosted Appwrite 2.4.0. An observer subscribes to the presences channel.
  2. A signed-in user creates a presence over REST, as in the docs' heartbeat pattern:
    PUT /v1/presences/{presenceId} with status: 'online', permissions: ['read("any")', 'update("user:<id>")', 'delete("user:<id>")'].
  3. With an API key, block the user (PATCH /v1/users/{id}/status → false) or delete the user (DELETE /v1/users/{id}).
  4. GET /v1/presences/{presenceId} and watch the observer.

👍 Expected behavior

Blocking or deleting a user removes their presences (and sends presences.*.delete), like their sessions, tokens, memberships and targets are removed.

👎 Actual Behavior

The presence stays readable (GET → 200, with status and metadata) and no delete event is sent, after blocking and even after deleting the user. It disappears only when expiresAt passes (15 minutes by default, up to 30 days if the client set it), and the expiry cleanup sends no event either. Reproduced 2 of 2 runs. A deleted user keeps showing as "online" to everyone who can read the presence.

Presences created over a realtime connection are not affected: blocking or deleting the user closes the connection, and onClose removes them.

Cause: Deletes::deleteUser() (src/Appwrite/Platform/Workers/Deletes.php) deletes sessions, keys, memberships, tokens, authenticators, challenges, identities and targets, but not presenceLogs; blocking the user does not touch presences at all.

🎲 Appwrite version

2.4.0

💻 Operating system

Linux (Debian 12), Docker

🧱 Your Environment

Self-hosted, Postgres adapter, two API/realtime nodes.

💡 Suggested fix

Delete the user's presences in deleteUser() and when the user is blocked, and trigger presences.*.delete for each, so subscribers update immediately.

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find a similar issue

🏢 Have you read the Code of Conduct?

  • I have read the Code of Conduct

Activity

  1. added
    api / realtime
    product / auth
    product / functions
    product / messaging
    sdk / cli
    on Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    api / realtimeproduct / authproduct / functionsproduct / messagingsdk / cli

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions