Open
Description
Bug report
- [ x ] I confirm this is a bug with Supabase, not with my own application.
- [ x ] I confirm I have searched the Docs, GitHub Discussions, and Discord.
Describe the bug
In an Expo app in development mode with an iOS simulator, going offline and back online and then reloading the app results in realtime being stuck in errors even through reloads until the app is force quit.
This may be in development-only, but not sure because it blocked releasing to production. We've had multiple reports of a bug in Legend State (LegendApp/legend-state#362) which track back to this root problem.
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
This was reproduced by multiple people starting from the Expo with-legend-state-supabase example, but it may happen in any Expo project.
Add this code to log the error:
supabase
.channel(`LS_TEST`)
.on(
'postgres_changes',
{
event: '*',
table: 'todos',
schema: 'public',
},
(payload) => {
console.log('payload', payload);
},
)
.subscribe((status, error) => {
console.log('status', status);
console.log('error', error);
});
- Quit app if already open
- Open app, realtime connects
- Go offline and back online
- Reload app in dev tools
- Realtime errors forever even with more reloads, until app is fully restarted with this log:
status CHANNEL_ERROR
error undefined
Expected behavior
Realtime should work after reload
System information
- OS: macOS
- Browser (if applies): Expo with iOS simulator
- Version of supabase-js: 2.45.1
- Version of Node.js:20