Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Realtime Events not respecting options #27

Open
Kuffs2205 opened this issue Apr 25, 2023 · 11 comments
Open

Realtime Events not respecting options #27

Kuffs2205 opened this issue Apr 25, 2023 · 11 comments
Labels
bug Something isn't working upstream-issue Awaiting fix from dependent service/repo

Comments

@Kuffs2205
Copy link

Kuffs2205 commented Apr 25, 2023

In my options, I am listening only for Updates.

        TestChannel = client.Realtime.Channel($"MyChannel-{parentID}")
        TestChannel.Register(New PostgresChangesOptions("public",
                                                        "TestData",
                                                        PostgresChangesOptions.ListenType.Updates,
                                                        $"parent=eq.{parentID}"))

        Await TestChannel.Subscribe

However, I am also receiving Inserts and Deletes.

Also, the Delete messages received do not correlate to my filter. Every single client gets every single delete even when the delete is for a different parentID.

Reproduction Steps

Click "Insert Subscribed Row" - The Insert event is fired Incorrect as I'm listening only for updates
Click "Insert Random Row" - No event fired Correct

In Supabase studio.

Edit one of the random rows (X=1,Y=1) No event fired Correct
Edit one of the subscribed rows (X=99,Y=99) Update Event fired Correct
Delete one of the subscribed rows Delete Event Fired Incorrect as I'm not listening for deletes
Delete one of the random rows Delete Event Fired Incorrect as I'm not listening for deletes AND I'm not subscribed to those records

https://github.com/Kuffs2205/TestRealtime.git

I'm up to 10,000,000 messages this month. I queried this as it seemed excessive. Now I see the Delete issue, it makes sense.

I wasn't sure if I should post the url and key publicly so I didn't but I can give it you if you want it.

@acupofjose
Copy link
Contributor

Thanks for the report @Kuffs2205 - As this library is modeled off of realtime-js, went there to attempt to reproduce. I was able to reproduce the same issue on @supabase/[email protected] with the delete filter not being respected. We'll see what they have to say!

@Kuffs2205
Copy link
Author

Thanks for taking a look. I'm never quite sure if it's just me with a poor understanding or not.

@acupofjose
Copy link
Contributor

Looks like this is a limitation known by the team at realtime - filters on delete events are currently unsupported. I'm going to keep this open to track it! (See the referenced issue)

@acupofjose acupofjose added the upstream-issue Awaiting fix from dependent service/repo label Apr 26, 2023
@Kuffs2205
Copy link
Author

So filters do not work at all then as PostgresChangesOptions.ListenType.Updates still gives me Inserts and Deletes too.

This is not sustainable. Literally millions of messages being sent and charged that I do not want and my user base is not yet that big. Hope they sort it soon or at least document it better so people don't fall into the trap of paying for unwanted messages.

@acupofjose
Copy link
Contributor

@Kuffs2205 unfortunately I'm just a volunteer library maintainer - but I absolutely agree with you. Maybe consider reaching out to supabase support about considering your account status and being charged for extra, unwanted events?

@Kuffs2205
Copy link
Author

I wasn't suggesting you were at fault at all. Sorry if it seemed so.

@acupofjose
Copy link
Contributor

No worries - just wanted to offer a course of action in the meantime!

@Kuffs2205
Copy link
Author

Can I just clarify something as it seems that all the focus was the "eq" filter not working for deletes but there was another issue in that:

PostgresChangesOptions.ListenType.Updates
PostgresChangesOptions.ListenType.Inserts

was also not being respected and all events were being returned regardless of what was asked for

Is this related or a separate issue?

@acupofjose
Copy link
Contributor

🤦 I got caught up in the filter thing that I forgot to check the second part of your issue! Let me get back to you on that.

@acupofjose
Copy link
Contributor

Okay, so I can confirm that there is a bug in the library's code. It is sending a request to subscribe to all events instead of respecting the options - so good catch there - I'll issue a quick fix for that - Thank you!!

However, I can also duplicate the same issue on the javascript library, where a postgres_changes listener is started with the expectation of only receiving UPDATE events, but the socket sends INSERT and DELETE events as well.

SO! You are correct. The library is not respecting the options (fix coming momentarily). But the websocket server sends events regardless (upstream issue that I also need to make another issue for)!

@Kuffs2205
Copy link
Author

Thanks for checking that out. I really appreciate your efforts on this library. I wouldn't be using Supabase without it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working upstream-issue Awaiting fix from dependent service/repo
Projects
None yet
Development

No branches or pull requests

2 participants