{"id":706,"hash":"38e6653bfdab01dd83c699728ed4354e592e717b011116e5122b8b58bb6ceece","pattern":"Supabase client permission denied for schema public","full_message":"Whenever I've try to use @supabase/supabase-js to query the db, I get an error.\n\nerror: {\n    hint: null,\n    details: null,\n    code: '42501',\n    message: 'permission denied for schema public'\n}\n\nI 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.\n\nAny suggestions on how to fix this? I would really like to be able to use the Supabase REST API and Prisma together.","ecosystem":"npm","package_name":"postgresql","package_version":null,"solution":"Please don't just run a Grant All Privileges to every type of possible user access to your database.\n\nThe access needed depends on what the sql is doing.\nIe, 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...\n\nI 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.\n\nFirst error I had was\n\n{\n code: '42501',\n  details: null,\n  hint: null,\n  message: 'permission denied for schema public'\n}\n\nWhich was resolved with\n\ngrant usage on schema \"public\" to anon;\ngrant usage on schema \"public\" to authenticated;\n\nThat then lead to this error\n\n   {\n  code: '42501',\n details: null,\n  hint: null,\n  message: 'permission denied for table xxx'\n }\n\nWhich that was resolved with\n\nGRANT SELECT, INSERT, UPDATE ON ALL TABLES IN SCHEMA \"public\" TO authenticated;\nGRANT SELECT, INSERT, UPDATE ON ALL TABLES IN SCHEMA \"public\" TO anon;\n\nSee below for some sources (because thats what 9th grade english class taught me to do)\n\nGithub issue\n\nDocs about Grants","confidence":0.95,"source":"stackoverflow","source_url":"https://stackoverflow.com/questions/67551593/supabase-client-permission-denied-for-schema-public","votes":23,"created_at":"2026-04-19T04:51:32.033725+00:00","updated_at":"2026-04-19T04:51:32.033725+00:00"}