Open RentfireFounder opened 1 year ago
I cannot reproduce this issue. Are you able to share a concrete repro-case and possibly console logs?
supabase.channel('filtered-channel')
.on(
'postgres_changes',
{
event: '*',
schema: 'public',
table: 'users_list'
},
(payload) => console.log('Filtered Channel Payload:', payload),
)
.subscribe();
supabase.channel('global-channel')
.on(
'postgres_changes',
{
event: '*',
schema: 'public',
},
(payload) => console.log('Global Channel Payload:', payload),
)
.subscribe();
console.log('Listening for events');
@kamilogorek
Both of these don't log on update when I have enabled RLS policy on table
React.useEffect(() => {
console.log('here');
serviceSubscription.current = supabase
.getClient()
.channel(`service-data-${serviceName}`)
.on(
'postgres_changes',
{
event: '*',
schema: 'public',
table: 'services_connected',
},
(payload) => console.log('Change', payload),
)
.subscribe();
supabase
.getClient()
.channel(`service-data`)
.on(
'postgres_changes',
{
event: '*',
schema: 'public',
},
(payload) => console.log('Global', payload),
)
.subscribe();
}, []);
Where
class Supabase {
client: SupabaseClient<Database>;
constructor() {
const token = localStorage.getItem(SUPABASE_LOCAL_STORAGE_TOKEN_NAME);
if (token) {
this.client = createClient<Database>(VITE_SUPABASE_URL, VITE_SUPABASE_ANON_KEY, {
global: {
headers: {
Authorization: `Bearer ${token}`,
},
},
});
} else {
this.client = createClient<Database>(VITE_SUPABASE_URL, VITE_SUPABASE_ANON_KEY);
}
}
createClient(authToken: string) {
this.client = createClient<Database>(VITE_SUPABASE_URL, VITE_SUPABASE_ANON_KEY, {
global: {
headers: {
Authorization: `Bearer ${authToken}`,
},
},
});
}
getClient(): SupabaseClient<Database> {
return this.client;
}
}
const supabase = new Supabase();
Here is my RLS policy. (Normal Select queries work as expected).
@kamilogorek Any update on this?
@RentfireFounder it's working locally but not working when using Supabase infrastructure?
@filipecabaco no it's working when RLS is disabled but not working when RLS is enabled.
With RLS enabled, the select/update and normal queries work but realtime doesn't
if this is the problem with my RLS rules, why is normal queries working and not realtime?
Also, more on this comment: https://github.com/supabase/realtime-js/issues/254#issuecomment-1773552145
@RentfireFounder just to confirm you're spinning up the Supabase stack locally correct? This is a locally running version of Realtime that RLS is not working for you. Is that right?
@w3b6x9 Yap!
@w3b6x9 @filipecabaco @kamilogorek were you able to replicate it? any updatea?
@RentfireFounder sorry for the radio silence, we had a couple of outstanding issues...
One of them could be related with this: what is the URL you are using to connect?
Hello, i got the same error... my RLS are well executed (log in a postgres function) but the realtime does not return the change @filipecabaco
Exact same thing is happening with me, (working with only prod) with RLS turned on i only get DELETE events. No matter what RLS policy I add I dont see any events coming in. Like the OP said on turning RLS off again postgres changes start flowing again.
UPDATE: I added a SELECT policy with anon role set as TRUE (not recommended but it worked for now and can carry on with the dev)
@filipecabaco @w3b6x9 i am using localhost
hey everyone, sorry we were working on a lot of changes and were not able to dedicate enough time to close this issue.
is this issue persisted? were you able to tackle it?
@filipecabaco nope, Also, just in case, did you see this comment? could it be because I am creating my own jwt and using that>
We do have an issue currently with custom jwts where the errors are not properly shown to the user 😞 I wonder if this is related 🤔
Bug report
Describe the bug
Supabase Realtime doesn't get emit events when provided with table name, but works without table name in localhost
To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
/database/replication
and turned onsupabase_realtime
In Javascript, If I do something like this, this won't work
but this would
Expected behavior
I was expecting to receive events when provided with
table_name
Screenshots
If applicable, add screenshots to help explain your problem.
System information