supabase / realtime-js

An isomorphic Javascript client for Supabase Realtime server.

Home Page:https://supabase.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BUG: Fatal error listening on DB Changes, DELETE

nkreiger opened this issue · comments

Bug report

  • [ x ] I confirm this is a bug with Supabase, not with my own application.
  • [ ] I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

/app/node_modules/@supabase/realtime-js/dist/main/lib/transformers.js:51
return Object.keys(record).reduce((acc, rec_key) => {
^

TypeError: Cannot convert undefined or null to object
at Function.keys ()
at Object.convertChangeData (/app/node_modules/@supabase/realtime-js/dist/main/lib/transformers.js:51:19)
at RealtimeChannel._getPayloadRecords (/app/node_modules/@supabase/realtime-js/dist/main/RealtimeChannel.js:475:40)
at /app/node_modules/@supabase/realtime-js/dist/main/RealtimeChannel.js:361:93
at Array.map ()
at RealtimeChannel._trigger (/app/node_modules/@supabase/realtime-js/dist/main/RealtimeChannel.js:348:16)
at /app/node_modules/@supabase/realtime-js/dist/main/RealtimeClient.js:295:47
at Array.forEach ()
at /app/node_modules/@supabase/realtime-js/dist/main/RealtimeClient.js:295:18
at Serializer.decode (/app/node_modules/@supabase/realtime-js/dist/main/lib/serializer.js:14:20)

To Reproduce

// setup channel handler
targets.forEach((tgt) => {
// channel.on('postgres_changes', { event: '*', schema: 'system', table: 'test' }, DefaultHandler);
channel.on('postgres_changes', { event: tgt.event, schema: tgt.schema, table: tgt.table }, handle);
})

Delete something from the table test DB

Expected behavior

I receive the removed record, not an error.

Screenshots

If applicable, add screenshots to help explain your problem.

System information

  • Version of supabase-js: 2.7.2

This happens if you have an authentication issue, the record comes back as null!

Maybe the handling could be better, as it was a bit confusing! Thanks