Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Joshokelola opened this issue Mar 16, 2024 · 2 comments
Labels
bug Something isn't working realtime This issue or pull request is related to realtime

Comments

@Joshokelola
Copy link

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

@Joshokelola Joshokelola added the bug Something isn't working label Mar 16, 2024
@dshukertjr dshukertjr added the realtime This issue or pull request is related to realtime label Mar 17, 2024
@Vinzent03
Copy link
Collaborator

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

@Joshokelola
Copy link
Author

Joshokelola commented Apr 14, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working realtime This issue or pull request is related to realtime
Projects
None yet
Development

No branches or pull requests

3 participants