Failed to start Websocket client , error: 'Operation is not supported on this platform.'

Open
#324 5 comments 0 reactions 1 assignee View on GitHub

@Tr00d is already working on this.

Since Jul 3, 2026.

Assessment

This issue has not been assessed yet.

Description

area: realtime bug

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:

socket.Options.SetRequestHeader(header.Key, header.Value);

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

  1. Create a new Blazor WASM project.
  2. Install the Supabase NuGet package v1.1.1.
  3. Register Supabase in DI Container (or manually create an instance of it) as shown below:
builder.Services.AddSingleton(sp =>
    {
        var client = new SupabaseClient(
            Constants.Supabase.Url,
            Constants.Supabase.ApiKey,
            new()
            {
                AutoRefreshToken = true,
                AutoConnectRealtime = true,
                SessionHandler = sp.GetRequiredService<SupabaseSessionProvider>()
            });

        return client;
    }
);

Call InitializeAsync on the Supabase client:

await supabase.InitializeAsync();

Expected behavior

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.

System information

  • OS: macOS
  • Browser: Arc (Chromium)
  • Supabase NuGet Package Version: 1.1.1
Dominant language
C#
Stars
701
Forks
106
Avg merge
16h 35m
Merged PRs (30d)
45

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from supabase/supabase-csharp

All issues in supabase/supabase-csharp

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.