I'm facing an issue where INSERTs and UPDATEs are ...
# help
t
I'm facing an issue where INSERTs and UPDATEs are not replicated (realtime) but DELETEs are?
n
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
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
tavin (2022-04-09)
t
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
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
Alright, I'll see if I can find something as well in the mean time.
g
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
Yes
I've tried with my service_role key as well
Without success
g
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
Doubled checked everything just now
Yes, it is hosted
I've tried with and without RLS
and insert/update are toggled on replication
g
I'd send in a support request, I've seen several cases of realtime issues needing support to "touch" the server...
t
Alright then
Thanks for the help tho, really appreciate it
g
YOu could slam in supabase-js and use the .subscribe method as a sanity check.
t
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
The thing I hate about hosted services is you can't just whack the side of the box to get it going....
t
What do you mean about hosted? Like hosted in Supabase's services?
or like another server that I created on EC2 for instance
g
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
Yeah, on free plan
g
Make sure to use the help tab in the project as it sends all the info they need to see your instance.
t
Sure, will do
Thanks
g
@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
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
Hey thanks for letting me know.. I'll add that to my list of questions to ask next time...