Supabase client permission denied for schema public
Whenever I've try to use @supabase/supabase-js to query the db, I get an error.
error: {
hint: null,
details: null,
code: '42501',
message: 'permission denied for schema public'
}
I think it has something to do with Prisma, which I use to handle migrations. The client worked fine when I was just clicking around with a prototype, but after setting up Prisma, it doesn't work anymore.
Any suggestions on how to fix this? I would really like to be able to use the Supabase REST API and Prisma together.Please don't just run a Grant All Privileges to every type of possible user access to your database. The access needed depends on what the sql is doing. Ie, If only need to select and insert then only provide those privileges, concerning if giving everyone access to truncate, and delete tables in your schema... I was having the issue of using supabase.rpc() to run some postgres functions. This function would select some data from a table, update a table, then insert into a new table. First error I had was { code: '42501', details: null, hint: null, message: 'permission denied for schema public' } Which was resolved with grant usage on schema "public" to anon; grant usage on schema "public" to authenticated; That then lead to this error { code: '42501', details: null, hint: null, message: 'permission denied for table xxx' } Which that was resolved with GRANT SELECT, INSERT, UPDATE ON ALL TABLES IN SCHEMA "public" TO authenticated; GRANT SELECT, INSERT, UPDATE ON ALL TABLES IN SCHEMA "public" TO anon; See below for some sources (because thats what 9th grade english class taught me to do) Github issue Docs about Grants
Get this solution programmatically \u2014 free, no authentication.
curl https://depscope.dev/api/error/38e6653bfdab01dd83c699728ed4354e592e717b011116e5122b8b58bb6ceece