-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What is RLS_DATABASE_URL #4
Comments
To connect to Postgres, you need to first createustom password and use that to a a role with a cuthenticate in your connection string. The claimsFn should be the decoded JWT obtained using Supabase Auth. For more guidance, please refer to the README.md file in this repository. Reading it a few times should make the process clear. |
Hi @Jonatthu, It is still not clear to me how to get this extension in my project. Do i need to clone the repo inside my project? Thank you in advance. |
Just copy the extension itself not the entire repo, then you can use it on prisma. Make sure you pass the claims on every single request |
thanks a lot @Jonatthu |
@Jonatthu would you accept to give a consultation on implementing this? I stumble upon a bunch of typescript errors. I need to move forward. Please let me know. |
Can you screenshot? |
here is the ts error I also ha this when passing the extention to the prisma client: |
I also get that TS error |
for anyone seeing above, you can just take out the explicit type annotation for client. so
|
Do you know why you have this type error and why it goes away when you remove the explicit PrismaClient? |
@remusris The type expected within the function is a |
What is
RLS_DATABASE_URL
and how do I get it? If I useRLS_DATABASE_URL="postgres://rls_user
and
const users = await prisma .$extends( useSupabaseRowLevelSecurity({ claimsFn: () => ({ sub: '8a3611fb-204b-4cf1-8111-17269f9c7dce', }), }), ) .users.findMany();
I get an error Not authorised
The text was updated successfully, but these errors were encountered: