refine
refine copied to clipboard
[BUG] Using different schema for Supabase prevents build, results in error
Describe the bug
Heya, I'm having trouble trying to use different table schema using Supabase for the template refine project
// utility/supabaseClient.ts
export const supabaseClient = createClient(SUPABASE_URL, SUPABASE_KEY, {
db: {
// problematic part vv
schema: "custom",
},
auth: {
persistSession: true,
},
});
That exact code results in the following error.
22:08:57.278 Executing user command: npm run build
22:08:57.892
22:08:57.892 > [email protected] build
22:08:57.892 > tsc && refine build
22:08:57.892
22:09:02.920 src/App.tsx(328,48): error TS2345: Argument of type 'SupabaseClient<any, "custom", any>' is not assignable to parameter of type 'SupabaseClient<any, "public", any>'.
22:09:02.921 Type '"custom"' is not assignable to type '"public"'.
22:09:02.921 src/App.tsx(329,48): error TS2345: Argument of type 'SupabaseClient<any, "custom", any>' is not assignable to parameter of type 'SupabaseClient<any, "public", any>'.
22:09:02.967 Failed: build command exited with code: 2
22:09:03.827 Failed: error occurred while running build command
Steps To Reproduce
- Get the Supabase refine template
- Change supabaseClient options schema from "public" to anything else
-
npm run build
- Error
Expected behavior
works
Screenshot
No response
Desktop
No response
Mobile
No response
Additional Context
No response
Hello @damywise this issue isn't related to refine and coming from supabase library.
You can check the following discussion on possible cause: https://github.com/orgs/supabase/discussions/1222
Best.
Hey @damywise, sorry for the issue! I've just checked and encountered the same issue when provided a different schema than public
. It looks like the SupabaseClient
type we expect in dataProvider
and liveProvider
methods of @refinedev/supabase
has unintended generic type fallbacks. We can update it like SupabaseClient<any,any,any>
to make sure it allows custom schemas.
If you want to work on this issue, we're welcoming all contributions 🙏 Check out the Contributing guide to get started!
I've added this task to our backlog but not sure if we can provide a fix for the next release.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.