supabase / realtime-js

An isomorphic Javascript client for Supabase Realtime server.
https://supabase.com
MIT License
323 stars 58 forks source link

Something wrong with catching errors from realtime subscriptions #416

Closed geoguide closed 2 months ago

geoguide commented 3 months ago

Bug report

Describe the bug

When a table doesn't exist or realtime isn't enabled you cannot get errors without having typescript errors.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

From help on the discord I found I can do this to get the errors:

.on(
  ..
)
  .subscribe((status, error) => console.info(status, error))
  .on('system', { event: 'error' }, (error: any) => {
      console.info('system', JSON.stringify(error))
})

but this doesn't appear to be documented and throws this typescript error:

image

Expected behavior

At least allow the typescript to accept the 'system' in this case so that I can get the errors in my code, and at best show how to handle this in the docs

Screenshots

System information

Additional context

Add any other context about the problem here.

filipecabaco commented 2 months ago

Will close since it's available in version 2.10.5 - https://github.com/supabase/realtime-js/issues/121

geoguide commented 2 months ago

Thanks @filipecabaco !!!