supabase / supabase-flutter

Flutter integration for Supabase. This package makes it simple for developers to build secure and scalable products.
https://supabase.com/
MIT License
661 stars 154 forks source link

Realtime randomly stops working #886

Closed mattermoran closed 2 months ago

mattermoran commented 2 months ago

Describe the bug

I'm running into a very strange issue that I'm having trouble reproducing but it's being reported a lot on production. The app uses realtime streams extensively for pretty much all the queries. That seems to be ok and there were no issues on firestore before but now that we migrated to supabase streams sometimes just stop emitting any data and it only gets fixed after app restart. As I said I can't really reproduce locally so I'm not sure if there's maybe some connection drop or we hitting some kind of a limit.

The usage of streams is just typical

  Stream<List<T>> watchMany() {
    return supabase.from(tableName).stream(primaryKey: ['id']).map(
      (data) => data.map((e) => fromJson(e)).toList(),
    );
  }

Is there any tips to debug this or idea what could be going on?

JakesMD commented 2 months ago

Same here :confused: Realtime just stops after a while when connected to a remote database. We can't reproduce the issue locally and no error ist thrown. Updates just stop coming through.

This issue has been around for well over a year, though, with no solution. (https://github.com/supabase/supabase-flutter/issues/388)

Pretty poor show. Superbase is cool. But we really don't care about any other fancy features you guys might be implementing if the basics don't work.

And as with any open source project, most of us users don't have the time or the knowledge to mess around in the supabase code ourselves.

I'll open a bottle of champagne on your behalf when you get this fixed. :champagne:

dshukertjr commented 2 months ago

Yup, this is a known issue, and we are sorry that we haven't been able to fix it yet. We have allocated some time to take a deeper look at the issue, but we have yet to find the cause, but the same issue does not happen on JS SDK, so we know it's the Flutter SDK's issue. I will take another stab at it soon.

Closing as a duplicate of https://github.com/supabase/supabase-flutter/issues/388

JasonChiu-dev commented 2 months ago

duplicate of #388

I don't think this is a duplicate of issue #388. We've been experiencing instability with Supabase for the past two weeks, resulting in unpredictable errors. This has caused significant disruption.

JasonChiu-dev commented 2 months ago

Describe the bug

I'm running into a very strange issue that I'm having trouble reproducing but it's being reported a lot on production. The app uses realtime streams extensively for pretty much all the queries. That seems to be ok and there were no issues on firestore before but now that we migrated to supabase streams sometimes just stop emitting any data and it only gets fixed after app restart. As I said I can't really reproduce locally so I'm not sure if there's maybe some connection drop or we hitting some kind of a limit.

The usage of streams is just typical

  Stream<List<T>> watchMany() {
    return supabase.from(tableName).stream(primaryKey: ['id']).map(
      (data) => data.map((e) => fromJson(e)).toList(),
    );
  }

Is there any tips to debug this or idea what could be going on?

I'm facing a similar issue. The stream listener isn't emitting the initial data, and it seems to be behaving unpredictably.

For the past two weeks, I've been experiencing instability with Supabase, leading to unpredictable errors. This has caused significant disruptions.

Have you been able to resolve the problem you mentioned?

mattermoran commented 2 months ago

Well given that I can't rely on realtime I decided to go oldschool and just do without streams. Instead I manually refresh my providers on creates/updates etc so I know it's always up to date in those cases.

Also to still have the realtime I manually subscribed to all db changes and refresh providers based on what changed. In this case it's more of a nice to have and if it stops working I still have the manual one.