After the app stays in the background for 6–8 hours or overnight, all Supabase requests fail with:
AuthRetryableFetchException(message: HandshakeException:
Connection terminated during handshake, statusCode: null)
This occurs even though everything works perfectly before the long background period — authentication, database reads/writes, storage, and realtime are all functioning normally.
Once this error occurs:
All Supabase operations fail (auth, postgrest, storage, realtime)
Realtime .onClose triggers but does not reconnect
The client does not recover even with retryable exceptions
Only a full app restart fixes the issue
The failure only occurs after the app resumes from a long idle state.
To Reproduce
- Login to the app normally (works fine).
- Use any Supabase functionality — all operations succeed.
- Put the app in the background.
- Leave it idle for 6+ hours (overnight).
- Reopen the app in the morning.
- Perform any Supabase operation (fetch, storage, realtime, etc.).
- Observe this error:
AuthRetryableFetchException(message: HandshakeException:
Connection terminated during handshake)
The client does not reconnect or refresh without restarting the app.
Expected behavior
- When the app resumes after long inactivity:
- The Supabase client should refresh the session token (auto-refresh is enabled)
- TLS handshake should succeed
- Realtime should reconnect
PostgREST, Storage, and Auth requests should work normally
There should be no fatal handshake or retryable exceptions after resume.
Version
- Flutter SDK
- Flutter: 3.35.4 (stable)
- Dart: 3.9.2
- iOS: 18.6.2 (real devices)
├── supabase_flutter 2.10.3
│ ├── supabase 2.10.0
│ │ ├── functions_client 2.5.0
│ │ ├── gotrue 2.16.0
│ │ ├── postgrest 2.5.0
│ │ ├── realtime_client 2.6.0
│ │ ├── storage_client 2.4.1
supabase_flutter Initialization
await Supabase.initialize( url: dotenv.get('****'), anonKey: dotenv.get('****'), httpClient: SupabaseHttpInterceptor(http.Client()), realtimeClientOptions: RealtimeClientOptions( logLevel: RealtimeLogLevel.info, ), authOptions: const FlutterAuthClientOptions( autoRefreshToken: true, ), );
Additional context
- This occurs on multiple real iOS devices (iPhone 11 and others)
- Networking in the rest of the app works fine — only Supabase handshake fails
- Seems linked to long idle + TLS session resumption + auth refresh
- Realtime .onClose prints after resume
- Reconnection attempts fail silently
- No permanent fix except restarting the app
Sentry Log (redacted)
AuthRetryableFetchException(message: HandshakeException:
- Connection terminated during handshake, statusCode: null)
- Device: iPhone 11
- iOS: 18.6.2
- Architecture: arm64
- Flutter: 3.35.4
- Dart: 3.9.2
- supabase_flutter: ^2.10.3
- Environment: production
Simple Visual Explanation
App Running → Background (6–8 hrs) → Resume App
↓
Supabase tries handshake + token refresh
↓
❌ HandshakeException (TLS terminated)
❌ AuthRetryableFetchException
❌ Realtime disconnects & does not reconnect
❌ All PostgREST/Storage/Auth calls fail
↓
Only fix = restart app
After the app stays in the background for 6–8 hours or overnight, all Supabase requests fail with:
AuthRetryableFetchException(message: HandshakeException:
Connection terminated during handshake, statusCode: null)
This occurs even though everything works perfectly before the long background period — authentication, database reads/writes, storage, and realtime are all functioning normally.
Once this error occurs:
All Supabase operations fail (auth, postgrest, storage, realtime)
Realtime .onClose triggers but does not reconnect
The client does not recover even with retryable exceptions
Only a full app restart fixes the issue
The failure only occurs after the app resumes from a long idle state.
To Reproduce
AuthRetryableFetchException(message: HandshakeException:
Connection terminated during handshake)
The client does not reconnect or refresh without restarting the app.
Expected behavior
PostgREST, Storage, and Auth requests should work normally
There should be no fatal handshake or retryable exceptions after resume.
Version
├── supabase_flutter 2.10.3
│ ├── supabase 2.10.0
│ │ ├── functions_client 2.5.0
│ │ ├── gotrue 2.16.0
│ │ ├── postgrest 2.5.0
│ │ ├── realtime_client 2.6.0
│ │ ├── storage_client 2.4.1
supabase_flutter Initialization
await Supabase.initialize( url: dotenv.get('****'), anonKey: dotenv.get('****'), httpClient: SupabaseHttpInterceptor(http.Client()), realtimeClientOptions: RealtimeClientOptions( logLevel: RealtimeLogLevel.info, ), authOptions: const FlutterAuthClientOptions( autoRefreshToken: true, ), );Additional context
Sentry Log (redacted)
AuthRetryableFetchException(message: HandshakeException:
Simple Visual Explanation
App Running → Background (6–8 hrs) → Resume App
↓
Supabase tries handshake + token refresh
↓
❌ HandshakeException (TLS terminated)
❌ AuthRetryableFetchException
❌ Realtime disconnects & does not reconnect
❌ All PostgREST/Storage/Auth calls fail
↓
Only fix = restart app