Skip to content

Conversation

@7ttp
Copy link
Contributor

@7ttp 7ttp commented Dec 4, 2025

summary

fixes the mismatch between server and client bindings for postgres changes error that occurs when subscribing to postgres_changes.

problem

when the client subscribes without a filter:

.on('postgres_changes', {
  event: '*',
  schema: 'public',
  table: 'notifications',
}, callback)

the server returns ilter: null in the response, but the client has ilter: undefined. the strict equality check ull === undefined returns false, causing a false mismatch error.

solution

added a helper method isFilterValueEqual that normalizes null to undefined before comparison. this handles the json serialization discrepancy between server and client.

changes

  • RealtimeChannel.ts: use normalized comparison for schema, table, and filter fields
  • RealtimeChannel.postgres.test.ts: added test cases for null and omitted filter scenarios

testing

all 21 postgres tests pass including 2 new tests that specifically cover this bug.

closes #1917

cc @mandarini

the server may return null for optional fields (schema, table, filter)
while the client has undefined. strict equality comparison fails when
comparing null === undefined, causing false mismatch errors.

this normalizes both values before comparison to handle the null/undefined
discrepancy that occurs during json serialization.

closes supabase#1917
@7ttp 7ttp requested review from a team as code owners December 4, 2025 06:27
@coveralls
Copy link

coveralls commented Dec 4, 2025

Coverage Status

coverage: 95.367% (+14.2%) from 81.176%
when pulling 1a5234e on 7ttp:bug1
into 336e498 on supabase:master.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CHANNEL_ERROR error: mismatch between server and client bindings for postgres changes

2 participants