Gustav Pernber
Gustav Pernber

Reputation: 1

Supabase realtime subscriptions times out

Im trying to listen to realtime changes in my react-native app from a supabase table called "profiles". Whatever i try, i can't get it to subscribe to change son the table. Even when copying the code snippet from the generated docs in Supabase:

const profiles = supabase.channel('custom-all-channel')
  .on(
    'postgres_changes',
    { event: '*', schema: 'public', table: 'profiles' },
    (payload) => {
      console.log('Change received!', payload)
    }
  )
  .subscribe()

Nothing happens when updating the table. When i pass a callback function to the subscribe method, it listens to events trigger on the subscription:


const profiles = supabase.channel('custom-all-channel')
  .on(
    'postgres_changes',
    { event: '*', schema: 'public', table: 'profiles' },
    (payload) => {
      console.log('Change received!', payload)
    }
  )
  .subscribe((event) => {
    console.log(event)
  })

However, the only event to trigger is the TIMED_OUT event.

I have enabled realtime changes to the "profiles" table in Supabase".

I've also tried changing the timeout to a longer amount of time, still doesn't work.

All other things like auth and normal fetching from the DB works fine.

I'm not using the local supabase Docker image for developing.

Am i missing something?

Upvotes: 0

Views: 1648

Answers (1)

Marvos
Marvos

Reputation: 277

I also encountered this issue, on Firefox. The realtime subscription worked for a day, then stopped working and started throwing TIMED_OUTs.

After quadruple checking everything else, including recreating the supabase installation, nothing helped.

Turns out the solution was to restart Firefox. No idea why, maybe they mess up their socket cleanup when refreshing a page, and reach a limit.

Upvotes: 1

Related Questions