I’m confused as i cant figure out the settings required for me to insert into private schema from javascript , both my tables in public and private has the same structure and I’m already using service keys but still getting Error upserting into Supabase: {} which from my understanding it’s returning null because my service keys has no permission?
The upsert is working perfect for public schema, just not the private schema.
async function sendToSupabase(details) {
const supabaseUrl = 'https://xx.supabase.co';
const supabaseKey = 'xx';
const supabase = createClient(supabaseUrl, supabaseKey);
try {
const { data, error } = await supabase
.from('private.events')
.upsert([
{
title: details.title,
}
], { onConflict: 'title' });
if (error) {
console.error('Error upserting into Supabase:', error);
} else {
console.log('Upserted into Supabase:', data);
}
} catch (error) {
console.error('Error in Supabase operation:', error.message);
}
}
Their documentation is lacking when it comes to using private schema and if anyone could provide any tips of guide , that would be greatly appreciated.
Things i’ve tried
-
Row Level Security disabled
-
Creating a policy for service_role when RLS is enabled