Plasmic and Supabase RLS Policies

Does plasmic support Supabase RLS policies?

Long story short…nope. As stated in the Plasmic documentation:

Supabase allows you to set Row Level Security (RLS) policies on tables, and it defaults to on. However, since Plasmic currently connects to Supabase with a direct connection, Plasmic is unable to use auth features and most RLS features. To query a table, you’ll need to make sure the table has RLS turned off or has a permissive RLS policy that enables read access for all users.

We have been talking about this in this post. If you strictly need RLS policies, I guess you will have to implement your own requests through the React library…

I tried to use Supabase SDK in Next.js API routes to replace the direct connection to database.
I have added an HTTP integration query that sends a request to Next.js API but in this route, I cannot get a user from supabase.auth.getUser(), it returns null even when I’m logged in, it’s confusing.

I use a Custom Auth provider with Supabase.
So, even with Supabase SDK RLS policies are not working.
Do you have any thoughts on what could be a problem here?

That’s strange because the part I was having problems with was authenticating the Plasmic user with the Supabase one, but not the other way around. How are you traying to use the getUser method? You have examples in the Github project from Plasmic or in the Supabase JS documentation

What getUser() do you refer to? Because I’m already using getUser() from supabase SDK.
I have implemented Auth using github examples for codegen project from Plasmic documentation.

The one I linked in my previous post. I am not using codegen though.