SupabaseS
Supabase3mo ago
Idris

Realtime error 401 unauthorized

Hi,

In my supabase project I lock down all schemas, tables etc for all roles that dont need them and manually grant it back where I see fit, following deny-by-default principle. I also use api instead of public, following Supabase's harding guidelines. I noticed that Supabase Realtime broke.

I get errors like
"{:error, \"Unable to subscribe to changes with given parameters. An exception happened so please check your connect parameters: [event: *, filter: user_id=eq.3adc3ac9-a617-4828-b7b6-ed04167fc1dc, schema: api, table: profiles_tasks]. Exception: ERROR P0001 (raise_exception) invalid column for filter user_id\"}" and Error 401: Unauthorized

Perhaps supabase realtime has a role I also need to grant usage to api and the specific tables. Because I have to enable permission per table like this:
grant
select
,
    insert (user_id, fcm_token),
update (user_id, fcm_token),
delete on table api.user_fcm_tokens to authenticated;

grant
select
,
    delete on table api.user_fcm_tokens to service_role;


logs:
https://hastebin.com/share/idusunedac.swift
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
Was this page helpful?