type information is wrong for RealtimePostgresChangesPayload
See original GitHub issueBug report
Not sure if this belongs here or in supabase/supabase-js.
Describe the bug
When using realtime subscriptions with v2.0.0 of supabase-js the payload type (RealtimePostgresChangesPayload
) does not match how the payload actually looks like.
When inspecting the payload in the browser it looks like this:
But RealtimePostgresChangesPayload
looks like this and does not contain e.g. record
, old_record
, columns
etc from the actual payload.
export type RealtimePostgresChangesPayload<T extends { [key: string]: any }> = {
schema: string
table: string
commit_timestamp: string
eventType:
| `${REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.INSERT}`
| `${REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.UPDATE}`
| `${REALTIME_POSTGRES_CHANGES_LISTEN_EVENT.DELETE}`
new: T | {}
old: Partial<T> | {}
errors: string[]
}
Even worse: old
and new
are present but always undefined
. So with the current state of the type I do not even get the data I need.
Expected behavior
RealtimePostgresChangesPayload
should reflect the actual payload type.
System information
- Version of supabase-js: 2.0.0
- Version of Node.js: 16.14.2
Issue Analytics
- State:
- Created a year ago
- Reactions:6
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Issues · supabase/realtime-js - GitHub
type information is wrong for RealtimePostgresChangesPayload bug Something isn't ... Ability to Generate Typescript Type Declarations from Server Schema ...
Read more >Supabase realtime-js Issues - Giters
type information is wrong for RealtimePostgresChangesPayload. Updated 23 days ago 9 ... Can't subscribe to database changes due to type ambivalence.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@samuba existing CLI’s Realtime is not yet compatible with supabase-js v2. Try it with the hosted Supabase when ready.
Thanks, will take a look.
Same issue here with the self hosted docker images and realtime-js@2.1.0. Any news for a update?