Skip to content

Delete multi ids subscriptions (Kicked out of supabase realtime) #458

Open
@MauruschatM

Description

@MauruschatM

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

After some time working in an app, that uses supabase Realtime, supabase seems to clear postgres subscriptions automatically. Therefore, the user doesn't get any updates.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

Simple Subscription Code snippet for solid-js. (Supabase Auth works in here).

const subscribe = siqn.supabase?.channel(`db-public-calculation_items-${calculationId}`)//.channel(`db-public-calculation_items-${calculation().id}`)
      .on("postgres_changes", {
        event: "*",
        schema: "public",
        table: "calculation_items",
        filter: `calculation_id=eq.${calculationId}`,
      }, (payload: any) => {
        switch (payload.eventType) {
          case "INSERT":
            setCalculationItems(prev => [...prev, mapCalculationItemFromPostgres(payload.new)]);
            updateSum();
            break
          case "UPDATE":
            setCalculationItems(prev => prev.map((item) => item.id === payload.new.id ? mapCalculationItemFromPostgres(payload.new) : item));
            updateSum();
            break
          case "DELETE":
            setCalculationItems(prev => prev.filter(i => i.id !== payload.old.id));
            updateSum();
            break
        }
      })
      .subscribe();

Expected behavior

Why does that happen? Maybe a small disconnect from internet? Or something with the accessToken? Do I have to add manual reconnects to the subsciption?

Screenshots

https://imgur.com/a/qlsnJq0

System information

  • OS: macOS
  • Browser (if applies): Safari
  • Version of supabase-js: 2.46.1
  • Version of Node.js: 18

Additional context

Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions