supabase-community / supabase-csharp

A C# Client library for Supabase
https://github.com/supabase-community/supabase-csharp/wiki
MIT License
501 stars 51 forks source link

Realtime Socket set to Null after Sign-In #107

Closed Kuffs2205 closed 1 year ago

Kuffs2205 commented 1 year ago

As the title suggests:

Works fine in 0.12.2 but Client.Realtime.Socket is set to null after signing in when using 0.13.0 or 0.13.1 ( I only install the Supabase-csharp package not each individual library)

' client.Realtime.Session Not Null
  Dim session = Await client.Auth.SignIn(email, password)
' client.Realtime.Session is now Null

Also, Can I ask what version this is resolved in: https://github.com/supabase-community/gotrue-csharp/pull/74 I have such trouble trying to work out if a fix is released or not. Are there any release notes?

acupofjose commented 1 year ago

#74 was released on 0.13.0 you can see the release notes in the CHANGELOG!

I'll need to look into the realtime socket being null, let me get back to you on that one.

acupofjose commented 1 year ago

@Kuffs2205 are you calling client.InitializeAsync() after it's been constructed? Or is it possible you're using a client that hasn't called that? That's the only way I can get your issue to duplicate currently.

Kuffs2205 commented 1 year ago

As far as I know yes.

Am I doing something wrong here ?

https://www.screencast.com/t/wBzSsmCus

acupofjose commented 1 year ago

Very odd. No that looks fine?

It looks like you're hitting this line somehow: https://github.com/supabase-community/supabase-csharp/blob/a8e16622591f67770dbbc14e11a52d32fd5589ff/Supabase/Client.cs#L225-L229

Which in turn references this:

https://github.com/supabase-community/realtime-csharp/blob/853c06c6b18e078cafe621bf0ada9e8cb01fee75/Realtime/Client.cs#L286-L298

So, it looks like the SignedOut event is being called without a SignedIn being followed up.

Oh! I think I see it. The socket isn't being restablished after a sign in. Let me get a fix out.

Kuffs2205 commented 1 year ago

I just noticed that you released 0.13.3. Tried it. No issue.

Went back to 0.13.2. Null Socket again. Not sure about the sign out. I seem to have a valid token back.

Anyway, it works with 13.3 so I'm all good. Thanks.

p.s Bookmarked the CHANGELOG. Even knowing it exists, I can't find it without the link :)

acupofjose commented 1 year ago

Yeah it was an incorrectly called disconnection on one of the event handlers! Glad it’s working for you. Maybe I can get a link for the changelog to show up on the wiki. Happy Friday!