Hello, I made a custom schema named "private". Whe...
# help
w
Hello, I made a custom schema named "private". When I try to access this schema (using react to-do list example) I get the error
Copy code
javascript
"The schema must be one of the following: public, storage"
I added the new schema to
Extra search path
I also tried running all of those commands:
Copy code
sql
create schema private AUTHORIZATION postgres;
grant usage on schema private to postgres, anon, authenticated, service_role;
grant create on schema private to postgres, anon, authenticated, service_role;
All of this doesn't work 😕 Can someone tell me what I'm missing to access my custom schema?
b
Are you trying to access the schema from the dashboard, from PostgreSQL functions, or from the JavaScript client, or something else?
If you're trying to use the JavaScript client, I think this is missing from the documentation, and should be what you need:
Copy code
const supabase = createClient(supabaseUrl, supabaseKey, {
  schema: "private",
});
you can only access one schema from a given client connection, so this connection cannot access anything in the
public
schema
and of course you have to give access to that schema, which I believe you have already done
I've added a PR to add this to the documentation.
w
Thanks for your reply. Yes, I'm using the Javascript client. I did add the createClient option
Copy code
javascript
{schema: "private"}
This caused the error
Copy code
javascript
"The schema must be one of the following: public, storage"
Now that you mentioned, I can only access one schema from a given client connection, I tried creating a separate client for just private and one for public. But I'm still getting the error.
OK I just saw an answer on my github discussion thread. This is not supported yet https://github.com/supabase/supabase/discussions/2528#discussioncomment-1122907
b
Yep, this was discussed by the staff about 12 hours ago, so it's on our radar. Watch that github thread for updates!