Open damywise opened 1 year ago
Running into the same problem. It's a blocker for running Edge Function tests as well if I need to create a client and use data in a non-public schema.
error: TS2322 [ERROR]: Type 'SupabaseClient<any, string, any>' is not assignable to type 'SupabaseClient<any, "public", any>'.
Type 'string' is not assignable to type '"public"'.
var client: SupabaseClient = createClient(supabaseUrl, supabaseKey, options) // options has db: { schema: 'my-schema' }
~~~~~~
A way to solve this would be to write it like this:
const supabase = createClient<Omit<Database, "public">>(
config.SUPABASE_URL,
config.SUPABASE_SERVICE_ROLE_KEY,
{
db: {
schema: "custom",
},
}
);
It seems that the typing only allow public
if public
is a key of Database
. Otherwise, it would allow the schema to be all possible keys of Database
. Hence, the removal of the key public
above.
Bug report
Describe the bug
Heya, I'm having trouble trying to use different table schema using Supabase for the template refine project
That exact code results in the following error.
To Reproduce
npm run build
Expected behavior
Works
Screenshots
If applicable, add screenshots to help explain your problem.
System information
Additional context
Also
npm start
works butnpm run build
doesn't