Skip to content
This repository was archived by the owner on Oct 9, 2025. It is now read-only.

Conversation

@rbasto1
Copy link
Contributor

@rbasto1 rbasto1 commented Sep 17, 2025

What kind of change does this PR introduce?

Bug fix

What is the current behavior?

When a record is changed, and that record is used by a row-level access policy, the record arriving in the subscription can be null. When convertChangeData tries to Object.keys(record), we get error:

@supabase_supabase-js.js?v=02935ef6:1614 Uncaught TypeError: Cannot convert undefined or null to object
    at Object.keys (<anonymous>)
    at convertChangeData (@supabase_supabase-js.js?v=02935ef6:1614:17)
    at _RealtimeChannel._getPayloadRecords (@supabase_supabase-js.js?v=02935ef6:2552:21)
    at @supabase_supabase-js.js?v=02935ef6:2438:83
    at Array.map (<anonymous>)
    at _RealtimeChannel._trigger (@supabase_supabase-js.js?v=02935ef6:2425:10)
    at @supabase_supabase-js.js?v=02935ef6:2947:96
    at Array.forEach (<anonymous>)
    at @supabase_supabase-js.js?v=02935ef6:2947:67
    at Serializer.decode (@supabase_supabase-js.js?v=02935ef6:1536:14)
image

What is the new behavior?

If the record is null, return an empty object to the caller of convertChangeData.

Additional context

Updated also the signature of the call to reflect that record can also be null.

@filipecabaco
Copy link
Member

are you able to replicate it in unit tests so we can guarantee good coverage?

@rbasto1
Copy link
Contributor Author

rbasto1 commented Sep 19, 2025

@filipecabaco done

@github-actions
Copy link

🚀 Preview Release Status

false


Last updated: 2025-09-20T08:38:52Z

@filipecabaco filipecabaco merged commit e6afc1c into supabase:master Sep 20, 2025
4 checks passed
@filipecabaco
Copy link
Member

thank you 🙏

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants