https://supabase.com/ logo
#help
Title
# help
t

tavin

04/09/2022, 11:16 PM
I'm facing an issue where INSERTs and UPDATEs are not replicated (realtime) but DELETEs are?
n

Needle

04/09/2022, 11:16 PM
Hello @tavin! This thread has been automatically created from your message in #843999948717555735 a ``few seconds ago``. Pinging @User so that they see this as well! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ... menu) and select Leave Thread to unsubscribe from future updates. Want to change the title? Use the
/title
command! We have solved your problem? Click the button below to archive it.
g

garyaustin

04/09/2022, 11:31 PM
Deletes ignore RLS. So likely you are not meeting RLS for select. Can you show your subscription call if you think you have RLS set correctly.
n

Needle

04/09/2022, 11:31 PM
tavin (2022-04-09)
t

tavin

04/09/2022, 11:32 PM
Is that what you meant?
I'm using
@supabase/realtime-js
btw
here's the whole thing, might be more helpful
I also have RLS disabled rn
g

garyaustin

04/09/2022, 11:36 PM
I'm thinking something else has to be done if you use just realtime-js versus supabase-js... I'll have to see if I can find the discussion. Possibly doc was not updated to current level...
something with the user token
t

tavin

04/09/2022, 11:37 PM
Alright, I'll see if I can find something as well in the mean time.
g

garyaustin

04/09/2022, 11:48 PM
So looks like the issue with docs, was the param apikey used to be missing in one of them, and is in both now (realtime.js and realtime server). Is your REALTIME_KEY your anon key?
t

tavin

04/09/2022, 11:54 PM
Yes
I've tried with my service_role key as well
Without success
g

garyaustin

04/09/2022, 11:57 PM
I don't use realtime-js (use supabase-js for realtime) But at a reasonable glance your code looks OK. Double check RLS, as that is what seeing delete only points to, and that you have insert/update toggled on in replication. Is this hosted?
t

tavin

04/09/2022, 11:58 PM
Doubled checked everything just now
Yes, it is hosted
I've tried with and without RLS
and insert/update are toggled on replication
g

garyaustin

04/09/2022, 11:59 PM
I'd send in a support request, I've seen several cases of realtime issues needing support to "touch" the server...
t

tavin

04/09/2022, 11:59 PM
Alright then
Thanks for the help tho, really appreciate it
g

garyaustin

04/10/2022, 12:00 AM
YOu could slam in supabase-js and use the .subscribe method as a sanity check.
t

tavin

04/10/2022, 12:00 AM
I've tried it as well haha
I'll try to reset the server or create another project
one more time
If it doesn't work, then I'll create a support request
g

garyaustin

04/10/2022, 12:02 AM
The thing I hate about hosted services is you can't just whack the side of the box to get it going....
t

tavin

04/10/2022, 12:02 AM
What do you mean about hosted? Like hosted in Supabase's services?
or like another server that I created on EC2 for instance
g

garyaustin

04/10/2022, 12:03 AM
It was a joke about hitting electronics and they start working. Sorry. You are using Supabase cloud, it seems you are since you say create another project?
t

tavin

04/10/2022, 12:05 AM
Yeah, on free plan
g

garyaustin

04/10/2022, 12:07 AM
Make sure to use the help tab in the project as it sends all the info they need to see your instance.
t

tavin

04/10/2022, 12:07 AM
Sure, will do
Thanks
g

garyaustin

04/10/2022, 12:27 AM
@tavin this might be it... var channel = socket.channel('realtime:public:rls_table', { user_token: JWT })
https://github.com/supabase/realtime#realtime-rls this was what seems missing in realtime-js docs versus realtime docs.... but... you said you also tried with supabase-js which does all this in the background.... so....
I've reported the doc issue and SB dev has responded it needs fixing.... not sure if that is your issue or not... https://github.com/supabase/realtime-js/issues/154
t

tavin

04/10/2022, 2:04 PM
Hey @garyaustin. I've contacted the support team and we were able to identify the issue. Quoted from the response:
There is an existing issue with Realtime where types that are wrapped by double quotes will break replication. Prisma is known to wrap types (enums) in double quotes.
. The temporary solution for it, is to recreate your project and avoid using enums. It's worth mentioning that it's not reversible, so you must recreate your project for it to work.
Once again, thanks for the support and attention. I really appreciate it.
g

garyaustin

04/10/2022, 2:17 PM
Hey thanks for letting me know.. I'll add that to my list of questions to ask next time...