supabase-community / realtime-csharp

A C# client library for supabase/realtime.
https://supabase-community.github.io/realtime-csharp/api/Supabase.Realtime.Client.html
MIT License
70 stars 12 forks source link

Can't deserialize PostgresChangesResponse #42

Closed nref closed 10 months ago

nref commented 10 months ago

Bug report

Describe the bug

Since today (may have started as long as two weeks ago), noticed I get a JsonReaderException in RealtimeChannel.HandleSocketMessage

image

To Reproduce

Deserialize a PostgresChangeResponse from supabase.com

Expected behavior

No exception

System information

Windows, .NET 7, supabase-csharp 0.15.0.

Other

It appears to me that payload.data.errors is null when the library expects it to be an array

image

acupofjose commented 10 months ago

Very odd. Given your bug report, this should be pretty easy to duplicate! But I'm unable to do so.

The declaration expects a nullable array (an, frankly, is null most of the time), see here.

The test suite encounters no errors on the latest local realtime server: v2.25.56, and throws no exception on deserialization.

Nor do I encounter an exception on a live project (supasharp-todo) on its current version v0.13.1 or after upgrading to v0.15.0.

Is there something missing from the bug report? It's been functioning totally fine up until now? Is the exception causing your application to exit?

nref commented 10 months ago

Thanks for the quick response. Let me try and make a minimal repro today. Based on your response, it's probably a combination of factors. Nothing has changed in my app or db though.

nref commented 10 months ago

Closing, thanks for your time. The JsonReaderException is happening, but it seems to be handled in supabase-csharp. It doesn't crash my app and doesn't seem to affect channel subscriptions. I only notice it in my log and when I enable it in Exception settings.

image

image

acupofjose commented 10 months ago

Glad it’s not affecting functionality! But I suppose that’s an uncaught exception that should be handled. I’ll check into it when I get home and see if I can get the logs to show and if we’re missing a handler somewhere! Thanks @nrefn!