Passing Supabase auth to web worker?

I have a web worker that’s calling a Supabase db function. Currently I have it creating a new Supabase client with the anon key in the worker. RLS prevents that from working correctly because access to the underlying table is set to only allow authenticated users. Disabling RLS gets it to work.

Users will be authenticated in order to invoke this at all. It follows that I should be able to pass the authentication along to call the db function with the right access. My question is simply: what is the correct way to do that? Nothing of what I’ve tried using data pulled from wwLib.wwPlugins.supabaseAuth has worked so far.

Thank you!

Why don’t you just use the workflow action called “Postgres Function”? otherwise, you need to use wwLib.wwPlugins.supabaseAuth.publicInstance and you can then use the .rpc() from their docs.