I am using Supabase v1.1.1 in a Blazor WebAssembly (WASM) application running on .NET 8. The issue occurs with this commit in the Supabase.Realtime package, so v1.1.0 is working without any issue. Specifically, the problem is on this line, where the following method is invoked:
This method is marked with [UnsupportedOSPlatform("browser")], and when calling InitializeAsync in a Blazor WASM application, the following exception is thrown:
Error: One or more errors occurred. (Failed to start Websocket client , error: 'Operation is not supported on this platform.')
To Reproduce
Create a new Blazor WASM project.
Install the Supabase NuGet package v1.1.1.
Register Supabase in DI Container (or manually create an instance of it) as shown below:
The InitializeAsync method should not throw an exception, or there should be a guard like [UnsupportedOSPlatform("browser")] to prevent setting AutoConnectRealtime to true on the WASM runtime.
Bug report
Describe the bug
I am using Supabase v1.1.1 in a Blazor WebAssembly (WASM) application running on .NET 8. The issue occurs with this commit in the Supabase.Realtime package, so v1.1.0 is working without any issue. Specifically, the problem is on this line, where the following method is invoked:
This method is marked with
[UnsupportedOSPlatform("browser")]
, and when callingInitializeAsync
in a Blazor WASM application, the following exception is thrown:To Reproduce
Register Supabase in DI Container (or manually create an instance of it) as shown below:
Call
InitializeAsync
on the Supabase client:Expected behavior
The
InitializeAsync
method should not throw an exception, or there should be a guard like[UnsupportedOSPlatform("browser")]
to prevent settingAutoConnectRealtime
totrue
on the WASM runtime.System information