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

PlatformException(channel-error, Unable to establish connection on channel., null, null) #861

Closed Joshokelola closed 2 months ago

Joshokelola commented 3 months ago

PlatformException(channel-error, Unable to establish connection on channel., null, null) When i try to run a project, the application compiles but before it even loads, i run into a Platform Exception (Note: When i debugged it, the issue pops up when supabase.initialize() is called.) Here's a snippet of the code -

Future<void> main() async {
  final container = ProviderContainer();
  final binding = WidgetsFlutterBinding.ensureInitialized();
  binding.addPostFrameCallback((_) async {
    Element? context = binding.rootElement;
    for (var asset in _allAssets) {
      precacheImage(AssetImage(asset), context!);
    }
  });
  await Supabase.initialize(
    url: 'SUPABASE_URL',
    anonKey:
        'ANON_KEY',
  );
  await Hive.initFlutter();
  await Hive.openBox('mainBox');
  runApp(
    const ProviderScope(

      child: MyApp(),
    ),
  );
}

Here's the snippet of the error: [ +14 ms] I/flutter (13228): ***** Supabase init completed Instance of 'Supabase' [ ] E/flutter (13228): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(channel-error, Unable to establish connection on channel., null, null) [ +1 ms] E/flutter (13228): [ ] E/flutter (13228): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(channel-error, Unable to establish connection on channel., null, null) [ ] E/flutter (13228):

To Reproduce Steps to reproduce the behavior: I'm not sure exactly how to do this but it just seems to be after i upgraded to the latest version of supabase (I was on v1 and i switched to v2). There were no breaking changes that directly affected my existing code (I think).

Version (please complete the following information): ├── supabase_flutter 2.3.4 │ ├── supabase 2.0.8 │ │ ├── functions_client 2.0.0 │ │ ├── gotrue 2.5.1 │ │ ├── postgrest 2.1.1 │ │ ├── realtime_client 2.0.1 │ │ ├── storage_client 2.0.1

Vinzent03 commented 2 months ago

Do you still experience this issue? Do you have a stacktrace when hitting the breaking point in debugging?

Joshokelola commented 2 months ago

I've resolved the issue. Thanks

On Tue, Apr 9, 2024, 3:23 PM Vinzent @.***> wrote:

Do you still experience this issue? Do you have a stacktrace when hitting the breaking point in debugging?

— Reply to this email directly, view it on GitHub https://github.com/supabase/supabase-flutter/issues/861#issuecomment-2045307194, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASZPHCIXI5PT5APT7A26ZUDY4P2WDAVCNFSM6AAAAABEZOQ7Z2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBVGMYDOMJZGQ . You are receiving this because you authored the thread.Message ID: @.***>