-
-
Notifications
You must be signed in to change notification settings - Fork 14
Stream Subscriptions die when auth token expires #35
Comments
@KirioXX we deployed Can you give it a try and let us know if the problem persists. Thank you. |
@phamhieu that's amazing just gave it a try and it's working like a charm. Thank you very much 🙌🌟 |
@phamhieu not related to this issue. VERBOSE-2:ui_dart_state.cc(209)] Unhandled Exception: LateInitializationError: Field 'changedAccessToken' has not been initialized.
#0 SupabaseClient.changedAccessToken (package:supabase/src/supabase.dart)
package:supabase/src/supabase.dart:1
#1 SupabaseClient._handleTokenChanged
package:supabase/src/supabase.dart:171
#2 SupabaseClient._listenForAuthEvents.<anonymous closure>
package:supabase/src/supabase.dart:165
#3 GoTrueClient._notifyAllSubscribers.<anonymous closure>
package:gotrue/src/gotrue_client.dart:442
#4 _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:539:8)
#5 GoTrueClient._notifyAllSubscribers
package:gotrue/src/gotrue_client.dart:442
#6 GoTrueClient._handleEmailSignIn
package:gotrue/src/gotrue_client.dart:353
<asynchronous suspension>
#7 _LoginPageState._signInEmailPW
package:tusks/…/login/login_page.dart:102
<asynchronous suspension> can it be that superbase_flutter also needs an update? |
Sorry, @phamhieu I think this needs to be reopened we still see the error now it's even more often. [sentry.runZonedGuarded] [error] Uncaught zone error
[sentry.runZonedGuarded] _CastError (type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'String?' in type cast)
[sentry.runZonedGuarded] #0 RealtimeSubscription.onError.<anonymous closure>
package:realtime_client/src/realtime_subscription.dart:97
#1 RealtimeSubscription.trigger
package:realtime_client/src/realtime_subscription.dart:225
#2 RealtimeClient.onConnMessage.<anonymous closure>.<anonymous closure>
package:realtime_client/src/realtime_client.dart:267
#3 Iterable.forEach (dart:core/iterable.dart:279:35)
#4 RealtimeClient.onConnMessage.<anonymous closure>
package:realtime_client/src/realtime_client.dart:266
#5 new RealtimeClient.<anonymous closure>
package:realtime_client/src/realtime_client.dart:88
#6 RealtimeClient.onConnMessage
package:realtime_client/src/realtime_client.dart:251
#7 RealtimeClient.connect.<anonymous closure>
package:realtime_client/src/realtime_client.dart:110
#8 _rootRunUnary (dart:async/zone.dart:1436:47)
#9 _CustomZone.runUnary (dart:async/zone.dart:1335:19)
#10 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
#11 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#12 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#13 _ForwardingStreamSubscription._add (dart:async/stream_pipe.dart:123:11)
#14 _HandleErrorStream._handleData (dart:async/stream_pipe.dart:253:10)
#15 _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:153:13)
#16 _rootRunUnary (dart:async/zone.dart:1436:47)
#17 _CustomZone.runUnary (dart:async/zone.dart:1335:19)
#18 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
#19 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#20 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#21 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:733:19)
#22 _StreamController._add (dart:async/stream_controller.dart:607:7)
#23 _rootRunUnary (dart:async/zone.dart:1436:47)
#24 _CustomZone.runUnary (dart:async/zone.dart:1335:19)
#25 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
#26 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#27 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#28 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:733:19)
#29 _StreamController._add (dart:async/stream_controller.dart:607:7)
#30 _StreamController.add (dart:async/stream_controller.dart:554:5)
#31 new _WebSocketImpl._fromSocket.<anonymous closure> (dart:_http/websocket_impl.dart:1144:21)
#32 _rootRunUnary (dart:async/zone.dart:1436:47)
#33 _CustomZone.runUnary (dart:async/zone.dart:1335:19)
#34 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
#35 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#36 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#37 _SinkTransformerStreamSubscription._add (dart:async/stream_transformers.dart:63:11)
#38 _EventSinkWrapper.add (dart:async/stream_transformers.dart:13:11)
#39 _WebSocketProtocolTransformer._messageFrameEnd (dart:_http/websocket_impl.dart:332:23)
#40 _WebSocketProtocolTransformer.add (dart:_http/websocket_impl.dart:226:46)
#41 _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:111:24)
#42 _rootRunUnary (dart:async/zone.dart:1436:47)
#43 _CustomZone.runUnary (dart:async/zone.dart:1335:19)
#44 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
#45 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#46 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#47 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:733:19)
#48 _StreamController._add (dart:async/stream_controller.dart:607:7)
#49 _StreamController.add (dart:async/stream_controller.dart:554:5)
#50 _Socket._onData (dart:io-patch/socket_patch.dart:2302:41)
#51 _rootRunUnary (dart:async/zone.dart:1444:13)
#52 _CustomZone.runUnary (dart:async/zone.dart:1335:19)
#53 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
#54 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
#55 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#56 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:733:19)
#57 _StreamController._add (dart:async/stream_controller.dart:607:7)
#58 _StreamController.add (dart:async/stream_controller.dart:554:5)
#59 new _RawSocket.<anonymous closure> (dart:io-patch/socket_patch.dart:1830:33)
#60 _NativeSocket.issueReadEvent.issue (dart:io-patch/socket_patch.dart:1314:14)
#61 _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
#62 _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5) As a short there solution, I tried to catch the error and restart the stream, but I can't pinpoint where the catch needs to happen. |
This is also occurring to me, but i fixed it by going back to an older version of supabase_flutter (with an older version of realtime_client |
Im on version 0.1.12+1, however on a fork (that was recently merged) (https://github.com/Vinzent03/realtime-dart) |
On the newest version 0.1.13 it is not working for me |
Hi @KirioXX @bit-burger I can't replicate the error on my side. Can you provide a step by step guide? It will help a lot. Thank you |
To reproduce this error on my end I do the following:
|
Thanks @clarky2233 |
@phamhieu Sorry for the delayed response. I build a test project to reproduce the issue: https://github.com/KirioXX/supabase_todo . |
I found out that the error only occurs when I recover auth session. In other words, subscribing after login directly doesn't have an issue, but subscribing after a session recovery has the issue. WorkaroundAfter a session recovery, update the final res = await supabaseClient.auth.recoverSession(sessionString);
supabaseClient.realtime.setAuth(res.data?.accessToken); // <~~~ this solves it Issue:The issue is that If |
I released a new
Can you give it a try. Thank you |
Closing as resolved! |
We noticed will testing that after some time that our streams were unexpectedly closed.
I tested it with a 60 second expiry time on the JWT and received this exception after 60s :
It might be related to this issue #28
The text was updated successfully, but these errors were encountered: